ok..

Nailogamer wrote: For Loops!!!
For Loops!!!
I dont understand for loops, like this one:

Code:

code:--------------------------------------------------------------------------------
#include <iostream.h>
int main()
{
for(int x=0;x<100;x++)
{ cout<<x<<endl;
}
std::cin.get();
return 0;
}
--------------------------------------------------------------------------------
How can I make it go up by 5, or by 10 till it gets to 100, how does the x++ work? I get x=0 and x<100, but not x++... can someone explain for loops to me?

After the first semicolon, x<100 is the condition for the loop. The loop will end if this condition returns false (i.e. assume "x" is 101 then the condition would be 101<100 which is not true and would cause "for" to exit the loop)

After the second semicolon, x++ means that x will be incremented by one for every time the the code in the loop has been executed.