Else error

I have a problem with else it says "error expected a statement"
then cout << "well done your not a dumbass" endl; the end; says expected a ; when everything has a ;
Im new to this just saying..

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
  #include <iostream>

using std::cout;
using std::cin;
using std::endl;

int main()
{
int awnser;
cout << "A wild bear is wanting a fight" << endl;
cout << "1. FIGHT" << endl;
cout << "2. run" << endl;
cin >> awnser;

if (awnser == 2);
{
	cout << "well done your not a dumbass" endl;
                }
else
{	 
	cout << "Well... your a dumbass" endl;
	cout << "GAME OVER" endl; 

	
}
return 0;

}
if (awnser == 2);
this line should not end in a semicolon.

The semicolon here is interpreted to mean an empty statement, like this:
1
2
    if (awnser == 2)
        ; // empty statement 


The cout statement at line 17 has a missing << operator before endl;
Last edited on
Topic archived. No new replies allowed.