Expand|Select|Wrap|Line Numbers
- #include <iostream>
- #include <iomanip>
- #include <fstream>
- #include <limits>
- using namespace std;
- class student
- {
- string name;
- string id;
- int credit[46];
- float pointer[46];
- float gpa[8];
- float totalCredit;
- float cgpa=0;
- float sumTotalCredit;
- float credpoint;
- int sem, currentSub;
- float x;
- float sumCredPoint;
- public:
- float getTotalCredit()
- {
- return totalCredit;
- }
- void setTotalCredit(float t)
- {
- totalCredit=t;
- }
- float getSumTotalCredit()
- {
- return sumTotalCredit;
- }
- void setSumTotalCredit(float c)
- {
- sumTotalCredit=c;
- }
- float CalculateGpa(float i,int k){
- return i/k;
- }
- float getCredPoint()
- {
- return credpoint;
- }
- void setCredPoint(float r)
- {
- credpoint=r;
- }
- float getCurrentSub()
- {
- return currentSub;
- }
- void setCurrentSub(int s)
- {
- currentSub=s;
- }
- float getSumCredPoint()
- {
- return sumCredPoint;
- }
- student(string name,string id)
- {
- this->name=name;
- this->id=id;
- }
- string getName()
- {
- return name;
- }
- string getId()
- {
- return id;
- } };
- int main()
- {
- /*system("color 07");
- cout<<"\n\n\n\tPlease wait while loading ..\n\n";
- char a=177, b=219;
- cout<<"\t ";
- for (int i=0;i<=12;i++)
- cout<<a;
- cout<<"\r";
- cout<<"\t ";
- for (int i=0;i<=12;i++)
- { cout<<b;
- for (int j=0;j<=1e8;j++); }*/
- system("cls");
- ofstream myfile;
- myfile.open("Transcript.txt");
- int Choice;
- cout<<"\n Examination Result"<<endl;
- cout<<"\n\t1) Faculty of Computing"<<endl;
- cout<<"\n\tPlease enter the number of your faculty: ";
- cin>>Choice;
- system("cls");
- cout<<"\n Examination Result"<<endl;
- switch (Choice){
- case 1 :
- cout<<"\n\tFaculty: Faculty of Computing"<<endl;
- break; }
- if (Choice==1){
- cout<<"\n\tList of our courses:"<<endl;
- cout<<"\t1) SCSR (Computer Network & Security)"<<endl;
- cout<<"\n\tPlease enter the number of your course: ";
- cin>>Choice;
- if (Choice !=1) {cout<<"\n\tChoice not valid. Please exit ! xD";
- return 0; }
- system("cls");
- myfile<<cout<<"\n Examination Result"<<endl;
- cout<<"\n Examination Result"<<endl;
- myfile<<"\n\tFaculty: Faculty of Computing"<<endl;
- cout<<"\n\tFaculty: Faculty of Computing"<<endl;
- myfile<<"\tCourse : SCSR (Computer Network & Security)"<<endl;
- switch (Choice){
- case 1 :
- cout<<"\tCourse: SCSJ (Computer Network & Security)"<<endl;
- break;
- } }
- else { cout<<"\n\tSorry ! We're currently working on this. xD"<<endl;
- return 0;
- };
- string* subject=new string[46];
- string studentname;
- string matricid;
- bool bFail;
- cin.ignore();
- do {
- cout<<"\n\tStudent Name: ";
- getline (cin,studentname);
- bFail=cin.fail();
- } while (bFail==true);
- cout<<"\tMatric Number: ";
- cin>>matricid;
- student st1(studentname, matricid);
- subject[0]="Discrete Structure ";
- subject[1]="Programming Technique I ";
- subject[2]="Technology & Information Systems ";
- subject[3]="Digital Logic ";
- subject[4]="Graduate Success Attributes ";
- subject[5]="Malaysian Dynamic/ Malaysian Studies ";
- int credit[46];
- float pointer[46];
- float gpa[8];
- float totalCredit;
- float cgpa=0;
- float sumTotalCredit;
- float credpoint;
- int sem, currentSub;
- float x;
- float sumCredPoint;
- cout << "\tCurrent Semester (Now): ";
- cin >> sem;
- int k=0;
- for(int i=0; i < sem ; i++)
- {
- cout << "\n\n\tNumber of Subjects: ";
- cin >> currentSub;
- cout<<"\t============================================================"<<endl;
- cout<<"\t\t\t\t SEMESTER " << i+1 <<endl;
- cout<<"\t============================================================"<<endl;
- cout<<"\tLIST OF SUBJECTS :\t\t CREDIT HRS:"<<" POINTER:"<<endl;
- myfile<<"\n\t============================================================"<<endl;
- myfile<<"\t\t\t\t SEMESTER " << i+1 <<endl;
- myfile<<"\t============================================================"<<endl;
- myfile<<"\tLIST OF SUBJECTS :\t\t CREDIT HRS:"<<" POINTER:"<<endl;
- for(int j=0; j < currentSub; j++)
- {
- cout << "\t" << subject[k];
- myfile << "\t" << subject[k];
- cin >> credit[k];
- myfile << credit[k];
- cout<<"\t\t\t\t\t\t\t ";
- cin >> pointer[k];
- myfile <<"\t\t"<<pointer[k]<<endl;
- totalCredit = totalCredit + credit[k];
- st1.setTotalCredit(totalCredit);
- x = (credit[k]*pointer[k]);
- credpoint = credpoint + x;
- k++;
- }
- gpa[i] = st1.CalculateGpa(credpoint,totalCredit);
- sumTotalCredit = sumTotalCredit+totalCredit;
- sumCredPoint = sumCredPoint + credpoint;
- cgpa = sumCredPoint/sumTotalCredit;
- x=0;
- credpoint = 0;
- totalCredit=0;
- cout<<"\t============================================================"<<endl;
- cout << "\t\t\t\t GPA = "<< gpa[i]<<" /"<<" CGPA = "<< cgpa << endl;
- myfile<<"\t============================================================"<<endl;
- myfile<< "\t\t\t\t GPA = "<< gpa[i]<<" /"<<" CGPA = "<< cgpa << endl;
- }
- cout<<"\n\tStudent Name: "<<st1.getName()<<endl;
- cout<<"\tMatric Number: "<<st1.getId()<<endl;
- cout<<"\tThe Final CGPA (Latest): "<< cgpa <<endl;
- myfile<<"\n\tStudent Name : "<<st1.getName()<<endl;
- myfile<<"\tMatric Number: "<<st1.getId()<<endl;
- myfile<<"\tThe Final CGPA (Latest): "<< cgpa <<endl;
- return 0;
- }