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
- #include<iostream.h>
- #include<conio.h>
- //www.programmingisbest.blogspot.com
- void main()
- {
- float x[5]; float cpa;
- char name[15],fname[15]; int i=1; int cr[5]; float result[5];
- cout<<"please enter your name: ";
- cin>>name;
- cout<<"please enter your father name:";
- cin>>fname;
- cout<<"please enter your previous cgpa = ";
- cin>>cpa;
- while(i<6)
- {//www.programmingisbest.blogspot.com
- cout<<"enter the marks of the subject"<<i<<" = ";
- cin>>x[i];
- cout<<"enter the credit hour of that subject = ";
- cin>>cr[i];
- result[i]=cr[i]*x[i];
- i++;
- }
- int gm;float sum; float gpa;
- gm=cr[1]+cr[2]+cr[3]+cr[4]+cr[5];
- sum = result[1]+result[2]+result[3]+result[4]+result[5];
- gpa=sum/gm;
- cout<<"\n\n\n\n";
- cout<<"xxxxxxxxxxxxxxxxxxxxxxxxxxxx\n"; cout<<"xxxR.E.S.U.L.Txxx\n"; cout<<"xxxxxxxxxxxxxxxxxxxxxxxxxxxx\n";
- cout<<"Your gpa is as under = "<<gpa<<endl; float kk; kk=(gpa*cpa)/2; cout<<"your cgpa is as under = "<<kk<<endl;
- if(kk>2 && kk<4)
- {
- cout<<"You are Qualified";
- }
- else if(kk<2 && kk>1.5)
- {
- cout<<"You are Probiation";
- }
- else if(kk<1.5)
- {
- cout<<"You are at chance";
- }
- else {
- cout<<"try again";
- }
- getch();
- }