Basic C++ Programs

HELP!!
I am having trouble figuring out what the following prints out:

1. for(r = 1; r < MAX; r++)
for(s = 0; s < MAX -r; s++)
if (ary[s] < ary [s + 1 ])
{ tmp = ary[s];
ary[s] = ary[s + 1];
ary[s + 1] = tmp;
}
for(r = 0; r < MAX; r++)
cout << ary[r] << " ";


2.a. for(i = 0; i < 10; i++)
for(j = 0; j < 5; j++)
matrix[i] [j] = (i+j)*(i+j); // i+j squared

b. Write the above code to print out the above array where you print one row of matrix per line of output

c. Show what is printed for the previous code first four (4) times of output

These are my study questions not homework or testing questions....thanks

Last edited on
$ dict homework
Studies or other preparatory work done prior to some activity; -- usually
used of preparations for activities of significance or consequence for
the performer
Topic archived. No new replies allowed.