When I try to compile I get this error:
1>------ Build started: Project: snake, Configuration: Debug Win32 ------
1> exercise.cpp
1>c:users
obindocumentsvisual studio 2010projectssnakesnakeexercise.cpp(13): error C2059: syntax error : '>='
1>c:users
obindocumentsvisual studio 2010projectssnakesnakeexercise.cpp(16): error C2059: syntax error : '>='
1>c:users
obindocumentsvisual studio 2010projectssnakesnakeexercise.cpp(19): error C2059: syntax error : '>='
1>c:users
obindocumentsvisual studio 2010projectssnakesnakeexercise.cpp(22): error C2059: syntax error : '>='
1>c:users
obindocumentsvisual studio 2010projectssnakesnakeexercise.cpp(25): error C2059: syntax error : '>'
1>c:users
obindocumentsvisual studio 2010projectssnakesnakeexercise.cpp(28): error C2059: syntax error : '=='
1>c:users
obindocumentsvisual studio 2010projectssnakesnakeexercise.cpp(34): warning C4065: switch statement contains 'default' but no 'case' labels
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Code:
#include <iostream>
using namespace std;
int main(){
int score;
//Vraag de score
cout << "Score:";
cin >> score;
//Switch
switch(score){
case >= 100:
cout << "a";
break;
case >= 50:
cout << "b";
break;
case >= 25:
cout << "c";
break;
case >= 10:
cout << "d";
break;
case > 0:
cout << "e";
break;
case == 0:
cout << "f";
break;
default:
cout << "BAD VALUE";
break;
}
cout << endl;
return 0;
}
How can I fix this problem? It's a console application, Win32 and my IDE is Windows Enterprise C++ 2010.
I'm learning from Beginning C++ Through Game Programming.
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…