Here's the code I have written. I keep getting parse errors and since I've started programming only a couple weeks ago I really don't quite understand what the error is for.
if (answer_16 == 'Y')
cout << "Is your number less than 2?" << endl;
char answer_32 = 0;
cin >> answer_32;
if (answer_32 == 'Y')
cout << "Is your number 1?" << endl;
char answer_64 = 0;
cin >> answer_64;
if (answer_64 == 'Y')
cout << "Told You" << endl;
else if (answer_64 == 'N')
cout << "You must of messed up somewhere..." << endl;
else
cout << "I hope you thought that was funny..." << endl;
else if (answer_32 == 'N')
cout << "Is your number 2?" << endl;
char answer_65 = 0;
cin >> answer_65;
if (answer_65 == 'Y')
cout << "Told You" << endl;
else if (answer_65 == 'N')
cout << "You must of messed up somewhere..." << endl;
else
cout << "I hope you thought that was funny..." << endl;
else
cout << "I hope you thought that was funny..." << endl;
int main()
{
cout << "Think of a whole number 1 through 100?" << endl
<< "Got it?" << endl
<< "Now I'm going to figure out what number you thought of in 7 questions." << endl
<< "Is your number less than 50? (Y for yes and N for no)" << endl;
char answer_1 = 0;
char answer_13 = 0;
cin >> answer_1;
if (answer_1 == 'Y')
cout << "Is your number less than 25?" << endl;
char answer_2 = 0;
cin >> answer_2;
if (answer_2 == 'Y')
cout << "Is your number less than 12?" << endl;
char answer_4 = 0;
cin >> answer_4;
if (answer_4 == 'Y')
cout << "Is your number less than 6?" << endl;
char answer_8 = 0;
cin >> answer_8;
if (answer_8 == 'Y')
cout << "Is your number less than 3?" << endl;
char answer_16 = 0;
cin >> answer_16;
if (answer_16 == 'Y')
cout << "Is your number less than 2?" << endl;
char answer_32 = 0;
cin >> answer_32;
if (answer_32 == 'Y')
cout << "Is your number 1?" << endl;
char answer_64 = 0;
cin >> answer_64;
if (answer_64 == 'Y')
cout << "Told You" << endl;
else if (answer_64 == 'N')
cout << "You must of messed up somewhere..." << endl;
else
cout << "I hope you thought that was funny..." << endl;
else if (answer_32 == 'N')
cout << "Is your number 2?" << endl;
char answer_65 = 0;
cin >> answer_65;
if (answer_65 == 'Y')
cout << "Told You" << endl;
else if (answer_65 == 'N')
cout << "You must of messed up somewhere..." << endl;
else
cout << "I hope you thought that was funny..." << endl;
else
cout << "I hope you thought that was funny..." << endl;
that's just the beginning of a 1000 line code that for some reason my dumb ass thought would compile. probably an epic fail but hey, that's how we learn.
int main()
{
cout << "Think of a whole number 1 through 100?" << endl
<< "Got it?" << endl
<< "Now I'm going to figure out what number you thought of in 7 questions." << endl
<< "Is your number less than 50? (Y for yes and N for no)" << endl;
char answer_1 = 0;
char answer_13 = 0;
cin >> answer_1;
if (answer_1 == 'Y')
cout << "Is your number less than 25?" << endl;
char answer_2 = 0;
cin >> answer_2;
if (answer_2 == 'Y')
cout << "Is your number less than 12?" << endl;
char answer_4 = 0;
cin >> answer_4;
if (answer_4 == 'Y')
cout << "Is your number less than 6?" << endl;
char answer_8 = 0;
cin >> answer_8;
if (answer_8 == 'Y')
cout << "Is your number less than 3?" << endl;
char answer_16 = 0;
cin >> answer_16;
if (answer_16 == 'Y')
cout << "Is your number less than 2?" << endl;
char answer_32 = 0;
cin >> answer_32;
if (answer_32 == 'Y')
cout << "Is your number 1?" << endl;
char answer_64 = 0;
cin >> answer_64;
if (answer_64 == 'Y')
cout << "Told You" << endl;
elseif (answer_64 == 'N')
cout << "You must of messed up somewhere..." << endl;
else
cout << "I hope you thought that was funny..." << endl;
elseif (answer_32 == 'N')
cout << "Is your number 2?" << endl;
char answer_65 = 0;
cin >> answer_65;
if (answer_65 == 'Y')
cout << "Told You" << endl;
elseif (answer_65 == 'N')
cout << "You must of messed up somewhere..." << endl;
else
cout << "I hope you thought that was funny..." << endl;
else
cout << "I hope you thought that was funny..." << endl;
elseif (answer_16 == 'N')
cout << "Is your number less than 4?" << endl;
char answer_33 = 0;
cin >> answer_33;
if (answer_33 == 'Y')
cout << "Is your number 3?" << endl;
char answer_66 = 0;
cin >> answer_66;
if (answer_66 == 'Y')
cout << "Told You" << endl;
elseif (answer_66 == 'N')
cout << "You must of messed up somewhere..." << endl;
else
cout << "I hope you thought that was funny..." << endl;
elseif (answer_33 == 'N')
cout << "Is your number 4?" << endl;
char answer_67 = 0;
cin >> answer_67;
if (answer_67 == 'Y')
cout << "Told You" << endl;
elseif (answer_67 == 'N')
cout << "Your number is 5, unless you messed up somewhere..." << endl;
else
cout << "I hope you thought that was funny..." << endl;
First, I'd make sure all your if statements are applying to the blocks you want. Normally, an if statement only applies to the single statement afterward unless you use { } to create a larger block.
1 2 3 4 5 6 7 8 9
if(stuff())
foo();
bar(); // these aren't included
bar2();
if(stuff()) {
foo();
bar(); // now they are included
bar2();
}