English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

i have to make a programm of form
1 4 9
16 25 36
49 64 81
i'm very confuse because outer loop (while) repeates one digit for th given no in inner loop while inner loop repeated all digit by the times given in outer loop suppose i give condition in outer to run no 1-3 and in inner 12 then the result will be
outer 11 22 33
inner 12 12 12... like this can you help me

2007-02-13 03:16:54 · 1 answers · asked by marwa 1 in Computers & Internet Software

1 answers

Think of it this way... your outer loop controls the rows and your inner loop controls the columns. So, if you name the variables R and C, you'd get a loop structure similar to this:

int R, C, myArray[3][3];
...
for (R=0; R<3; R++) {
for (C=0; C<3; C++) {
cout << myArray[R][C] << " ";
}
cout << endl;
}

2007-02-13 04:43:37 · answer #1 · answered by BigRez 6 · 0 0

fedest.com, questions and answers