You mean something like this?
1 2 3 4 5 6 7 8
|
int k = 0;
int j = 1;
do
{
cout << j << ","<< k <<endl;
k++;
}while ( k < 20 );
|
By the way this can be done easy using 2D arrays.
Last edited on
no, i want it to be displayed this way
1,2,1,3,1,4,1,5,1,6,1,7,1,8,1,9,1,10
Well then remove the
endl
:p not that hard to figure out.
here just compile this whole thing:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
#include <iostream>
using namespace std;
int main()
{
int k = 0;
int j = 1;
do
{
cout << j << ","<< k <<" ";
k++;
}while ( k < 11 );
return 0;
}
|
Last edited on
Then start k off at 2 instead of 0.
does anybody know a different method to do it that uses the if command?