//1 3 5 7 9 11 amount of number:6 counter of loop: 6-1:5(2-2-2-2-2)
There are more than one way to say that.
A:
* You want the first number to be 1
* You want next number to be previous+2
* You want last number to be 11
We do not care how many numbers there will be.
1 2 3 4
for ( int x=1; x <= 11; x+=2 ) {
std::cout << x << ' ';
}
std::cout << '\n';
B:
* You want the first number to be 1
* You want next number to be previous+2
* You want exactly 6 numbers
We do not care what the last number will be.
1 2 3 4 5
for ( int counter=0; counter < 6; ++counter ) {
int x = counter * 2 + 1;
std::cout << x << ' ';
}
std::cout << '\n';