Untitled

Run Settings
LanguageC++
Language Version
Run Command
#include <iostream> #include <cmath> #include <ctime> using namespace std; int main() { srand(time(NULL)); int arr[5][5], test[5][2]; int a = 0, col,b = 0; for (int i = 0; i < 5; i++) { for (int j =0; j < 5; j++) { arr[i][j] = rand() % 10; if (a < arr[i][j]) { a = arr[i][j]; col = j; } cout << arr[i][j] << "\t"; } cout << endl; } for (int j= 0; j < 5; j++) { test[0][j] = arr[j][j]; } cout << endl << endl << endl; for(int i =0; i<5;i++) for (int j = 4; j < 0; j--) { test[1][j] = arr[j][j]; } for (int i = 0; i < 5; i++) { for (int j = 0; j < 5; j++) { if (test[i][j] < test[j][i]) { arr[j][col] = test[i][j]; } else { arr[j][col] = test[j][i]; } cout << arr[i][j] << "\t"; } cout << endl; } system("PAUSE"); return 0; }
Editor Settings
Theme
Key bindings
Full width
Lines