#include<conio.h>
#include<iostream.h>
main()
{
clrscr();
char name[20], selection;
float q1,q2,qav,att,me,av;
cout<<"My Grading Sheet";
cout<<"\nEnter name: ";
cin>>name;
cout<<"\nEnter quiz 1: ";
cin>>q1;
cout<<"\nEnter quiz 2: ";
cin>>q2;
qav=(q1+q2) /2;
cout<<" \n The quiz average is: "<<qav;
cout<<"\nEnter attendance: ";
cin>>att;
cout<<"\nEnter Major Exam ";
cin>>me;
av=(qav+att+me)/3;
cout<<"\n Your grade "<<name<<" is "<<av;
cout<<"\n Have a nice day "<<name;
if (av>=75)
{
cout<<"\nYou passed!";
}
else
{
cout<<"\nYou failed!";
}
cout<<"\nYour rank "<<name<<" is "<<selection;
switch(selection)
{
case (100):
cout<<"A"<<endl;
break;
case (99):
cout<<"A"<<endl;
break;
case (98):
cout<<"A"<<endl;
break;
case (97):
cout<<"A"<<endl;
break;
case (96):
cout<<"A"<<endl;
break;
case (95):
cout<<"A"<<endl;
break;
}
getch();
}
Using swith structure
average of:
100-95 RANK "A"
94-90 RANK "B"
89-85 RANK "C"
84-80 RANK "D"
79-75 RANK "E"
74 and below RANK "F"
It may help if you tell us what the problem is that you are having. It looks like you are using 'old' c++, which is fine if you are also using an old compiler, but you may be given wrong advice.