i am currently working on the "Grading Program" that requires an "if statement to check the input that the uses enters on a scale of0 - 100 to be able to out put a grade! (i am following thde learning pattern given in this link... http://www.cplusplus.com/forum/articles/12974/ )
Now, on to my question...
i would really like some assistance in figuring out how to end this "if - else if" statement... there are currently 2 of them here at the moment, but a way to end one would solve both of them :D !
this is what is troubling me...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
if score < 0 or score > 100
cout<<"The grade you have selected doesn't match this grading scale1"<<endl;
//above code is used to make sure that the
//scale of 1 - 100 is used!
if score >= 0 and score <= 59
cout<<"You recieve an F for your grade"<<endl;
elseif score >= 60 and score <= 69
cout<<"You recieve a D for your grade"<<endl;
elseif score >= 70 and score <= 79
cout<<"You recieve a C for your grade"<<endl;
elseif score >= 80 and score <= 89
cout<<"You recieve a B for your grade"<<endl;
elseif score >= 90 and score <= 100
cout<<"You recieve an A for your grade"<<endl;
//above code is used to be able to set a boundry for
//the grading scale, so that diffrent grades can be
//used for the score achieved!
also, help in understanding "switch statements would be a great help ! any help would be appriciated! ty in advance!
This block of code is still giveing me problems...
in the Build Section, the errors that it is outputting to me are as follows...
1>c:\users\trey\documents\visual studio 2010\projects\grading program\grading program\gp source code.cpp(11): error C2061: syntax error : identifier 'score'
1>c:\users\trey\documents\visual studio 2010\projects\grading program\grading program\gp source code.cpp(14): error C2143: syntax error : missing ';' before ')'
1>c:\users\trey\documents\visual studio 2010\projects\grading program\grading program\gp source code.cpp(22): error C2181: illegal else without matching if
1>c:\users\trey\documents\visual studio 2010\projects\grading program\grading program\gp source code.cpp(22): error C2061: syntax error : identifier 'score'
1>c:\users\trey\documents\visual studio 2010\projects\grading program\grading program\gp source code.cpp(24): error C2143: syntax error : missing ')' before ';'
1>c:\users\trey\documents\visual studio 2010\projects\grading program\grading program\gp source code.cpp(25): error C2059: syntax error : ')'
1>c:\users\trey\documents\visual studio 2010\projects\grading program\grading program\gp source code.cpp(26): error C2181: illegal else without matching if
1>c:\users\trey\documents\visual studio 2010\projects\grading program\grading program\gp source code.cpp(26): error C2061: syntax error : identifier 'score'
1>c:\users\trey\documents\visual studio 2010\projects\grading program\grading program\gp source code.cpp(28): error C2143: syntax error : missing ')' before ';'
1>c:\users\trey\documents\visual studio 2010\projects\grading program\grading program\gp source code.cpp(29): error C2059: syntax error : ')'
1>c:\users\trey\documents\visual studio 2010\projects\grading program\grading program\gp source code.cpp(30): error C2181: illegal else without matching if
1>c:\users\trey\documents\visual studio 2010\projects\grading program\grading program\gp source code.cpp(30): error C2061: syntax error : identifier 'score'
1>c:\users\trey\documents\visual studio 2010\projects\grading program\grading program\gp source code.cpp(32): error C2143: syntax error : missing ')' before ';'
1>c:\users\trey\documents\visual studio 2010\projects\grading program\grading program\gp source code.cpp(33): error C2059: syntax error : ')'
1>c:\users\trey\documents\visual studio 2010\projects\grading program\grading program\gp source code.cpp(34): error C2181: illegal else without matching if
1>c:\users\trey\documents\visual studio 2010\projects\grading program\grading program\gp source code.cpp(34): error C2061: syntax error : identifier 'score'
1>c:\users\trey\documents\visual studio 2010\projects\grading program\grading program\gp source code.cpp(36): error C2143: syntax error : missing ')' before ';'
1>c:\users\trey\documents\visual studio 2010\projects\grading program\grading program\gp source code.cpp(37): error C2059: syntax error : ')'
I really want to understand this but thereis too much crap and i NEED someone to make it simple :P i know what your probably going to say is that there is no SIMPLE explination, but i need someone to make it a slight bit easier :P