...okay, i'm trying to make this program which accepts name, testscore, and marital status..then outputs them along with the letter grade based on test score. I don't think I'm using the cases right in the switch statement for test score, can anyone help?
Thanks in advance..Code:#define CB cin.ignore(cin.rdbuf()->in_avail()) #include <iomanip.h> #include <stdlib.h> main() { int TestScore, Grade; char Name[20], MarStat; cout<<"\n Enter a Student's Name: "; cin.getline(Name,20);CB; cout<<" Enter Student's Test TestScore: "; cin>>TestScore; CB; cout<<" Enter Student's Marital Status: "; cin>>MarStat; CB; while(TestScore != -1) { switch(TestScore) {case "TestScore<=100": case"TestScore>=90": Grade='A' ; case "TestScore<90": case "TestScore>=80": Grade='B' ; case "TestScore<80": case "TestScore>=70": Grade='C' ; case "TestScore<70": case "TestScore>=60": Grade='D' ; case "TestScore<60": case "TestScore>=0)": Grade='F' ; default: Grade="Invalid Grade";} switch(MarStat) { case 'M': case 'm': MarStat=" Married "; case 'S': case 's': MarStat=" Single "; case 'D': case 'd': MarStat=" Divorced "; case 'W': case 'w': MarStat=" Widowed ";} } cout<<"\n The Name of the Student: "<<Name; cout<<"\n The Marital Status of the Student: "<<MarStat; cout<<"\n The Test Score of the student: "<<TestScore; cout<<"\n The Letter Grade of the student: "<<Grade; system("PAUSE"); return 0; }