if statements

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.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <cstdlib>
#include <iostream>
#include <string>

using namespace 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;
}
.
THX/ROCK122
Last edited on
closed account (zb0S216C)
You're missing a terminating double-quote at the end of line 15:

1
2
// Line 15:
"...your choice.\n"; // <--- Here. 

Wazzak
Last edited on
oops that is there in my real code not sure why it isn't here....I just fixed it.
Last edited on
closed account (zb0S216C)
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.

 
if(c==1); // <--- Remove this semi-colon. 

I should've seen them before :)

Edit:

Don't call main(); ever.

Wazzak
Last edited on
Thanks
Topic archived. No new replies allowed.