PLEASE NEED HELP: Converting 2d array into a 1d array

Pages: 12
yeah just one more I just wanted to clarify that once I output that code you get 20 random integers: These are my diagonal integers right? Because my professor wrote that information like B[0][0] is copied to A[0]...ect. So I though I actually had to go and individually cout all these values. But with the code I just ran it looks like I have already gotten the 20 diagonal values.
With the code above you have the diagonal. If your prof wants it in some specific form, then you need to do more. Otherwise, what you have gives the diagonal you're looking for.
If you want to check

9
10
array[i][j]=(rand()%100);
cout << setw(3) << array[i][j]; //add this line 
Yeah my professor wanted me to also sort those diagonal elements and output the median value as well as the mean. But I already know how to do this on my own my main struggle was converting between arrays. Thanks fg109 that clarifies my question.
once again thanks LB, mgoetschius, and fg I appreciate all of your help!
Topic archived. No new replies allowed.
Pages: 12