You are trying to print too many things in your loops, which are nested (acting at the same time) instead of sequential.
1 2 3 4 5 6 7 8 9 10
|
for (int a=1; ...)
{
for (int b=12; ...)
{
for (int c=21; ...)
{
...
}
}
}
|
You have, BTW, changed your code since you got that output. Be careful about that, because people who know programming don't like you when you say "this is what I did" and "this is what I got" when the two don't match, and you are more likely to be ignored.
You need to think about how to create that output pattern yourself, using a pen and paper (as if someone gave you instructions to do it by hand) before you can make the computer do it. This is the rule of programming that few people will ever tell you.
As a hint, you will need two loops, nested. The outside loop will work from 1 to 100, inclusive. The inside loop will only count five items, but you will not print the inner loop's variable.
1 2 3 4 5 6 7 8 9
|
for (int a = 1; a <= 100; XXX)
{
for (int b = 0; b < 5; b++)
{
cout << a << " ";
}
YYY;
cout << endl;
}
|
At XXX and YYY you will do something to
a to make it have the numbers you want. What is it?
Hope this helps.