Need assistance with a else if loop

I'm going through and doing the beginner exercises(http://www.cplusplus.com/forum/articles/12974/) to review some of the earlier stuff I learned in my first C++ class I took two semester ago and I'm having an issue with the While( user == gullible ) program.

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;

int main() {
	int count = 0, number;
	cout << "Put in any number other than five. " << endl;
	cin >> number;
	while (number != 5) {
		cout << "Put in any number other than five." << endl;
		cin >> number;
		count++;
		if (count == 10) {
			cout << "Wow, you're more patient then I am, you win." << endl;
			break;
		}
		else if (number == 5) {
			cout << "Hey! You weren't supposed to enter 5!" << endl;
		}
	}

	system("pause");
	return 0;
}

My issue is that after I enter 5, it doesn't print out "Hey! You weren't supposed to enter 5!". Why is that? Is there a better way that I can do this? I also have one more question about cin.get() use over system("pause"). I know system("pause") is tied to the Windows OS(at least from what I've read), but when I use cin.get(), it doesn't pause the CMD window. How can I make it pause the CMD window so I don't have to use system("pause") anymore?
Remove line 7 and 8. Line 6: number = 0;
Topic archived. No new replies allowed.