I'm just starting to learn C++ in school and my current assignment is to make a one-question quiz program. I was wondering if someone can help me debug it. Here's the code and error message:
#include <iostream>
int main()
{
int guess;
int answer;
answer=3;
cout<< "\fWhich one of the choices is laughing the hardest?" <<endl;
cout<< "1) rofl" <<endl;
cout<< "2) jeje" <<endl;
cout<< "3) roflmao" <<endl;
cout<< "4) lol" <<endl;
cout<< "Enter the NUMBER of your choice" <<endl;
cin>> guess;
while (guess!= answer)
{
cout<< "No, try again"<<endl;
if (guess==1)
{
cout<< "Look for something more" <<endl;
}
if (guess==2)
{
cout<< "Think what sound a \"J\" makes in Spanish" <<endl;
if (guess==4)
{
cout<< "Just a chuckle makes a sound, the \"out loud\" doesn't really mean anything extra" <<endl;
}
if (guess>4)
{
cout<< "Excuse me, but can you count from 1 to 4 ?" <<endl;
}
if (guess<1)
{
cout<< "NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO!!!!!!!!!!" <<endl;
}
cin>> guess;
}
cout<< "Correct :D" <<endl;
cout<< "\n" <<endl;
return 0;
}
Error message:
quiz.cpp: In function `int main()':
quiz.cpp:51: syntax error at end of input
Line 51 is after the entire code (after the very last "}" ), that's what I'm having trouble with.
I'll appreciate any help I can get.