Hi all, can someone tell me why I get errors with this code?
Code:
#include <iostream>
using namespace std;
int main(){
char buf;
bool finished=false;
cout << "Enter something " << endl;
cin >> buf;
while(!finished){
switch(buf){
case "sloppyjoe":
cout << "Some good stuff! " << endl;
finished=true;
break;
case "cheeseburger":
cout << "Got french fries? " << endl;
finished=true;
break;
default:
cout << "That isn't on the list " << endl;
finished=true;
break;}}
return 0;
}
When I set case to something like this ...
It compiles and works fine, except when I make it a string. What's the problem? Here's the error I get..
case label does not reduce to an integer constant
Thanx.