I have used if statements before so i just copied the same format for my new one but it says there is something wrong this time. If you could help me find the problem it would be appreciated. The errors are on line 22 (the line of the first else) they are: 1) expected primary-expression before "else" and 2) expected ';' before "else". I'm pretty sure this means I'm missing a semi-colon but I can't see were.
#include <cstdlib>
#include <iostream>
#include <string>
usingnamespace std;
int main()
{
float c;
float health = 100;
cout << "Your health equals " << health << ".\n";
system("PAUSE");
cout << "You are bored on a saturday watching some TV show called Wipeout.\n";
system("PAUSE");
cout << "Your mom says she is going on a hike for a few hours.\nWhat do you do?\n1) Ask if you can go.\n2) Wait till she leaves and throw a party.\n3) Continue sitting on your butt all day.\nInput the number for your choice.\n";
cin >> c;
if(c==1);
{
cout << "You had a rather uneventful day.\n";
system("PAUSE");
}
else
{
if(c == 2);
{
cout << "you and your mom go on a hike.";
system("PAUSE");
}
else
{
if(c == 3);
{
cout << "Your mom comes home before the party ends and you are grounded for life.";
system("PAUSE")
}
else
{
cout << "Please choose one of the choices I gave you or be more exact."
system("PAUSE")
main()
}
}
}
return 0;
}
Also, you've got a semi-colon after the condition of each if and else if statement. Remove them. Finally, you're missing semi-colons after your system() calls.