Saturday 23 March 2013

C++ GPA & CGPA Calculator Program

You can see this program  in C# also at on another blog
http://csharpisbest.blogspot.com/2013/06/c-cgpa-caclulator-form-application.html 

Program of gpa calculator is also done in functions go to this link to view that code

  1. #include<iostream.h>
  2. #include<conio.h>
  3. //www.programmingisbest.blogspot.com
  4. void main()
  5. {
  6. float x[5]; float cpa;
  7. char name[15],fname[15];  int i=1; int cr[5]; float result[5];
  8. cout<<"please enter your name: ";
  9. cin>>name;
  10. cout<<"please enter your father name:";
  11. cin>>fname;
  12. cout<<"please enter your previous cgpa = ";
  13. cin>>cpa;
  14. while(i<6)
  15. {//www.programmingisbest.blogspot.com
  16. cout<<"enter the marks of the subject"<<i<<" = ";
  17. cin>>x[i];
  18. cout<<"enter the credit hour of that subject = ";
  19. cin>>cr[i];
  20. result[i]=cr[i]*x[i];
  21. i++;
  22. }

  23. int gm;float sum; float gpa;
  24. gm=cr[1]+cr[2]+cr[3]+cr[4]+cr[5];
  25. sum = result[1]+result[2]+result[3]+result[4]+result[5];
  26. gpa=sum/gm;
  27. cout<<"\n\n\n\n";
  28. cout<<"xxxxxxxxxxxxxxxxxxxxxxxxxxxx\n"; cout<<"xxxR.E.S.U.L.Txxx\n";   cout<<"xxxxxxxxxxxxxxxxxxxxxxxxxxxx\n";
  29. cout<<"Your gpa is as under = "<<gpa<<endl; float kk; kk=(gpa*cpa)/2; cout<<"your cgpa is as under = "<<kk<<endl;
  30. if(kk>2 && kk<4)
  31. {
  32. cout<<"You are Qualified";
  33.  }
  34.  else if(kk<2 && kk>1.5)
  35.   {
  36.   cout<<"You are Probiation";
  37.     }
  38.     else if(kk<1.5)
  39.     {
  40.     cout<<"You are at chance";
  41.     }
  42.     else {
  43.     cout<<"try again";
  44.      }
  45. getch();
  46. }