User Profile
Collapse
-
It seems like it should work, but apparently it doesn't. Thanks for your help. -
I see what you're saying about 90-100. Thanks. However, I tried this without success:
switch (ave)
{
case 'ave >= 90':
cout << "Your score is " << ave << " and your grade is an A." << endl;
break;
case 'ave >= 80 && ave < 90':
cout << "Your score is " << ave << "...Leave a comment:
-
Thanks for your help, but I just don't understand what you're saying. I've tried the following:
case 'ave >= 90'
but it didn't work.
I read through the section on switch statements. It said you cannot use a variable nor ranges as case values, which is what I appear to be doing. I searched that site and didn't get any hits on "conditiona ls". I don't know what "conditiona ls"...Leave a comment:
-
So you're saying it is impossible to use the switch statement to do what I'm trying to do?...Leave a comment:
-
Allowable Case Values in a Switch Statement?
I'm using Bloodshed's Dev-C++. I can't get this code to work. Can someone tell me what's wrong?
...Code:[B]int a, b, c, ave; cout << "Enter three test scores: " << endl; cin >> a >> b >> c; ave = (a + b + c)/3; switch (ave) { case '90-100': cout << "Your score is " << ave << " and your grade[/]Last edited by sicarie; Apr 4 '07, 06:20 PM. Reason: Please use [code] and [/code] tags around your code.
No activity results to display
Show More
Leave a comment: