if-else expected a statement error

Hey I just started C++ a few days ago and could use a little help. As stated above my else code is getting the error expected a statement and I cant quite find what i did wrong. I would assume it's the {} but I can't be sure so I thought I would ask for help
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 #include <iostream>
using namespace std;

class number { int number;
};

int main()
{
	    int number;
		cout << "please input a number between 0-100";
		cin >> number;

		if (number >= 0 && number <=100);
	
			cout << "you entered " << number << endl;
		else
        {
			number = invalid number
	    cout << " You have entered a " << number << end line;
        }
	
}

closed account (48T7M4Gy)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>

using namespace std;

int main()
{
    int number = 0;
    cout << "please input a number between 0-100: ";
    cin >> number;
    
    if (number >= 0 && number <=100)
        cout << "you entered " << number << endl;
    else
        cout << " You have entered " << number << " which is bad!" << endl;
    
    return 0;
}
thanks for the help. Guess I need to practice some more.
closed account (48T7M4Gy)
Yep, it makes perfect as they say and you had most of the basics right - just look carefully at the stuff I left out.

Topic archived. No new replies allowed.