View Single Post
Old 07-18-2005, 12:04 PM   #2 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,710
redhead is on a distinguished road
Code:
if (FamAnsw == Answ)
	{
		cout << "CORREECTT!!!/n";
		cout << "[Applause] [Bells] [Whistles] [explosions]/n";
	else
		cout << "ERRR! Wrong! Sry play again!/n";
	}
Just move the ending } up above teh else clause, since that tells where the if scope ends, and since the else is encapsulated in it, the compiler dosn't know when to use the else scope, so the code will be:
Code:
if (FamAnsw == Answ)
	{
		cout << "CORREECTT!!!/n";
		cout << "[Applause] [Bells] [Whistles] [explosions]/n";
              }
	else
		cout << "ERRR! Wrong! Sry play again!/n";
You might want to change FamAnsw and Answ to type std::string, since you can't store an entire string in a char. It has to either be a char* or a string, and when using char* you need to know how much memory it will take, where string will dynamicaly allocate teh memory needed, it is easier to use, pluss it has a buildin == operator, where char* dosnt, so you'd have to use strcmp() on that.

Oh, and your line ending, with /n should be \n, or std::endl, aswell with your /t it should be \t if you were trying to make a <tab> space.
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote