Help with setting up a for loop

My homework question is : set up a for loop to print values from n down to 1 with at most 5 values per line.
I am honestly confused with for loops and I don't know where to start.
Last edited on
closed account (1vD3vCM9)
we dont do your homework, but we can help.
other than that i get confused from the question as well.

i can try to help like that.

#include <iostream>

void main(){
for(int i = 0; i < 6; i++)
{
std::cout << i << std::endl;
}
}
Last edited on
The for loop:

for (initialise values; shall i continue; what i do after one loop)
http://www.cplusplus.com/doc/tutorial/control/

Skip to the for loop section. What you should basically think of the for loop is that it steps through anything in linear fashion. In other words, let's say you have to walk a certain distance to the supermarket down a road.

for( starting location is 0; distance to destination isn't reached yet; take a step forward )
Topic archived. No new replies allowed.