Alright... to let everyone know, even though I have spent some months studying programming. I'm not down with the linguo. Nor do I have as high as a vocabulary as valmont. So please, keep the vocab and linguo down a bit.
Alright the question. I am getting a parse error on my little game I am creating. One part where there is an if statement, I try to put an else statement in the code block immediatly after the if statement, when I compile it, it shows a parse error for the line with the else code. This is the actual code...
Code:
if (FamAnsw == Answ)
{
cout << "CORREECTT!!!/n";
cout << "[Applause] [Bells] [Whistles] [explosions]/n";
else
cout << "ERRR! Wrong! Sry play again!/n";
}
Heres the the full code if anyone wants to read it...
Code:
#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;
int main(int nNumberofArgs, char* pszArgs[])
{
char Fam;
char FamAnsw;
char Answ[] = "Franz Ferdinand";
cout << "/tWelcome To Family Fued George style/n";
cout << "Your host George Tuosto! [applause]/n";
cout << "Our family today is...\n";
cout << "Enter your name here: ";
cin >> Fam;
cout << "The " << Fam << " family!\n";
cout << "Here is your first question... ";
cout << "... Who was assassinated in 1914 that started WW1?/n";
cout << "Answer: ";
cin >> FamAnsw;
if (FamAnsw == Answ)
{
cout << "CORREECTT!!!/n";
cout << "[Applause] [Bells] [Whistles] [explosions]/n";
else
cout << "ERRR! Wrong! Sry play again!/n";
}
cout << "Thats it for todays show of Family Fued George style!\n";
return 0;
}
If someone could tell me why it outputs a parse error with the else code, plz tell me. Thanx in advance!
PS: By the way, just to let any newbies know... the book C++ for dummies, though not too hard to understand the chapters... don't go into depth with what parse errors or any usual error for that matter. Also doesn't give too many quizes on making your own programs, which would have help tremendosly. Pick up something else and stay away from this book.