srand(time(0));
const int size = 5;
int A[size][size]{};
for (size_t i = 0; i < size; i++) {
}
cout << endl << endl;
int max = A[0][0];
int index_max_y;
for (size_t i = 0; i < size; i++) {
}
for (size_t i = 0; i < size; i++) {
}
cout << "Result:" << endl;
for (size_t i = 0; i < size; i++) {
}
system("pause");
const int size = 5;
int A[size][size]{};
for (size_t i = 0; i < size; i++) {
for (size_t j = 0; j < size; j++) {
A[i][j] = rand() % 100;}
cout.width(3);
cout << A[i][j];
cout << endl;
}
cout << endl << endl;
int max = A[0][0];
int index_max_y;
for (size_t i = 0; i < size; i++) {
for (size_t j = 0; j < size; j++) {
if (max < A[i][j]) {}
max = A[i][j];}
index_max_y = j;
}
for (size_t i = 0; i < size; i++) {
for (size_t j = 0; j < size; j++) {
if (j == index_max_y) {}
int tmp = A[i][j];}
A[i][j] = A[i][size - 1];
A[i][size - 1] = tmp;
}
cout << "Result:" << endl;
for (size_t i = 0; i < size; i++) {
for (size_t j = 0; j < size; j++) {
cout.width(3);}
cout << A[i][j];
cout << endl;
}
system("pause");
Комментариев нет:
Отправить комментарий