Hey folks, another question for you guys...
I can write a basic switch statement no problem. But I am trying a more complex one that evaluates a players game score in 4 'tiers' out of 100, but it is not working so...
Heres the code first.
//Using switch statement to add more than 2 responses to player score
using namespace std;
int main ()
cout << "What was your score?";
cin >> score;
case (score <=25):
cout << "\nOuch, less than 25...!";
case (score <=50):
cout << "\nYou score aint great mate..";
case (score <=75):
cout << "\nYour pretty good, wel done man!";
case (score <=100):
cout << "\nYou got to the top!!!";
cout << "\nYou cant score higher than 100!!! Cheater!!!!";
My Complie log hits the first case statement and reports a case label does not reduce to an integer constant.
Ok, now, question one;
1) can I put a test into the value of each case?? If not, thats the simple answer, but if thats the case, what function would you use to achieve the same idea. If you can do the testing on to two..
2) my only other thought of why this isnt working is that the value is not realy an integer, as I believe that switch statements only work with integers, so it wouldnt work??
If its not one of the above two, can someone give me some help as to why its not working??? Thanks folks.
As an aside, I'm currently working with Dev C++ and using the book Beginning C++ Game Programming by Micheal Dawson, but I'm only just getting into the 3rd Chapter on Arrays....