/*WAP to enter marks of asgnignment ,mtterm,etterm and find the gde and write to a file.*/ #include #include #include #include #include class result { private: char name[35]; char roll[10]; int mt,et,asgn; char gde[3]; float total; public: result() { strcpy(name,'\0'); strcpy(roll,'\0'); mt=et=asgn=0; total=0.0; strcpy(gde,'\0'); } result(char *n, char *r, int m,int e, int a) { strcpy(name,n); strcpy(roll,r); mt=m; et=e; asgn=a; total=(float)((m+e+a)*100)/125; if(total>=0 && total<=39) strcpy(gde,"F"); if(total>=40 && total<=44) strcpy(gde,"D"); if(total>=45 && total<=49) strcpy(gde,"C"); if(total>=50 && total<=59) strcpy(gde,"C+"); if(total>=60 && total<=69) strcpy(gde,"B"); if(total>=70 && total<=79) strcpy(gde,"B+"); if(total>=80 && total<=89) strcpy(gde,"A"); if(total>=90 && total<=100) strcpy(gde,"A+"); } void InputMarks() { cin.get(); cout<<"\nEnter the Name : "; cin.getline(name,35); cout<<"Enter the Roll No : "; cin>>roll; cout<<"Enter the Mark of mt Term (<=30), et Term (<=70) and asgnignment (<=25) respectively :"; cin>>mt>>et>>asgn; total=(float)((mt+et+asgn)*100)/125; if(total>=0 && total<=39) strcpy(gde,"F"); if(total>=40 && total<=44) strcpy(gde,"D"); if(total>=45 && total<=49) strcpy(gde,"C"); if(total>=50 && total<=59) strcpy(gde,"C+"); if(total>=60 && total<=69) strcpy(gde,"B"); if(total>=70 && total<=79) strcpy(gde,"B+"); if(total>=80 && total<=89) strcpy(gde,"A"); if(total>=90 && total<=100) strcpy(gde,"A+"); cout<>ch; switch(ch) { case 1: std.InputMarks(); std.storeFile(std); cout<<"\n\tEntry Successful...!!!"; getch(); break; case 2: std.readFile(); getch(); break; case 3: exit(0); default: cout<<"\nInvalid choice....!!!"; } goto start; }