Есть ответ 👍

С++. определить максимальный элемент матрицы на главной диагонали и сумму элементов этой диагонали. размер матрицы вводить с клавиатуры, элементы, а также результат, разместить в памяти динамически.

167
382
Посмотреть ответы 2

Ответы на вопрос:


#include < iostream> #include < cstdlib> using namespace std; int main(){ int *enter = new int; cout < < "enter x: "; cin > > *enter; const int *x = new int(*enter); *enter = 0; cout < < "enter y: "; cin > > *enter; const int *y = new int(*enter); int *mat = new int[*x][*y]; for (int i = 0; i < *x; i++){ for (int j = 0; j < *y; j++){ cout < < "enter [" < < i < < "][" < < j < < "]: "; cin > > mat[i][j]; }; }; int *max = new int(0); for (int i = 0; i < *x; i++){ if (mat[*x] > *max){ *max = mat[*x]; }; }; }
agellertova
4,8(44 оценок)

Ответ: 5 * 60 * 16 * 64 / 1024 =  300 мб

Популярно: Информатика