Stickygoo... I'm stuck again
just a little noob problem. I stopped learning C++ for a while but have just got back into it, so I thought I'd do a little program to check I'm ok with basic stuff.
Anyway here it is, it's just a small maths game, but when I compile it (Borland Compiler) it says the variables 'guess' and 'answer' arn't used in the function main... When I'm pretty sure they are :confused:
Well, here's the code:
Code:
#include <iostream>
using namespace std;
int main()
{
int answer = 1, guess = 1, x = 1;
cout << "\n\n-----------------------------------\nSelect Difficulty\n1 - Easy\n2 - Medium\n3 - Hard\n4 - Quit\n\nChoice: ";
cin >> x;
switch(x)
{
case 1:
answer = 20;
while(guess ! = answer)
{
cout << "(27 + 13) / 2 = ";
cin >> guess;
if(guess ! = answer)
cout << "Wrong!";
}
cout << "Correct!";
break;
case 2:
answer = 170;
while(guess ! = answer)
{
cout << "(18 + 36) * 3 + 8 = ";
cin >> guess;
if(guess ! = answer)
cout << "Wrong!";
}
cout << "Correct!";
break;
case 3:
answer = 360;
while(guess ! = answer)
{
cout << "(84 + 23 - 7) * 3.5 + (36 / 6 + 4) = ";
cin >> guess;
if(guess ! = answer)
cout << "Wrong!";
}
cout << "Correct!";
break;
case 4:
cout << "End of program.";
break;
default:
cout << "Error: That is not an option";
}
}
Thanks if anyone can show me where I'm going wrong :)