Cout not printing in for loop
I cant seem to print int x within the for loop. Can anyone tell me why is cout not working inside a for loop?
using namespace std;
for (int x = 5; x < 5; x++)
cout << x << endl;
It's not working because x is never less than 5.
How many times do you think the loop is going to execute?
Hint: Never. If x starts at 5, the termination condition is never true.
Topic archived. No new replies allowed.