theDexMonster
Programmer
This may be a stupid question but I have to ask.
I am attempting to learn C++ using a book by Deitel and noticed an if/else statement written:
if ( grade >= 90 )
cout << "A";
else if ( grade >= 80 )
cout << "B";
else if (grade >= 70 )
cout << "C";
else if (grade >= 60 )
cout << "D";
else
cout << "F";
now... this looks all and good, except I don't understand why it would only print a "C" if you have a 72, rather than printing all that applies. (ie. >= 70 = C, B, A)
is there already, or can I define an operator or function called "between" and say: (>79 but <90);
I am attempting to learn C++ using a book by Deitel and noticed an if/else statement written:
if ( grade >= 90 )
cout << "A";
else if ( grade >= 80 )
cout << "B";
else if (grade >= 70 )
cout << "C";
else if (grade >= 60 )
cout << "D";
else
cout << "F";
now... this looks all and good, except I don't understand why it would only print a "C" if you have a 72, rather than printing all that applies. (ie. >= 70 = C, B, A)
is there already, or can I define an operator or function called "between" and say: (>79 but <90);