First, I would like to say hi to all members!
I just recently started my adventure with programming in C++ (and programming in general to be precise), and there's my first problem:
I try to use the a very simple FOR loop. It should return numers from 1 to y, but instead it returns 1 infinitely.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#include <iostream>
usingnamespace std;
int main()
{
int y;
cout << "Print numbers from 1 to ";cin >> y;cout << endl;
for(int x = 1 ; x < y ; x=x+1)
{
cout << x;
}
}
Yep that's true should be == or <=.
Main problem was something else, but I just managed to solve it: changed from 'debug' to 'release' build. BUT - is it normal and expected?
And one more thing. The condition which u gave is mentioning that the loop will work till a point where x<y. So whatever you input, the loop will never display the given input.