Simple while loop

I'm trying to learn how a while loop works but for some reason it still doesn't work here's my code:

1
2
3
4
5
6
7
8
9
10
#include <iostream>

int main () {
	int iCout = 0;
	while (iCout < 5) {
		iCout = iCout + 1;
		std::cout << iCout << std::endl;
		
	}
}
does anybody know whats wrong with it? please correct it if you can that would help alot
by the way i'm using Visual C++ 2008 express if you need to know
What does it do (i.e. Any errors? Doesn't do the intended thing?)?

What is it supposed to do for you?

Et cetera.

Make sure to post more than code and "What's the problem?". Being more specific helps you be answered.

Not meant to offend you. :)

Edit: put in this after the while loop:
1
2
cin.get();
return 0;

This will help.
Last edited on
Topic archived. No new replies allowed.