ДАЮ 40 БАЛОВ.
Срочно нужна помощь. С++

Мне нужно превратить (int mat[n][m]) в указатель так чтобі это работало((


#include

#include

#include

#include

#include

using namespace std;

int main()


{


setlocale(LC_ALL, "Ukr");


const int n = 3, m = 3;


printf("Кiлькiсть рядкiв матрицi = ");


scanf_s("%d", &n);


printf("Кiлькiсть стовпцiв матрицi = ");


scanf_s("%d", &m);


int mat[n][m];


srand(time(NULL));


printf("Була:\n ");


for (int i = 0; i < n; i++)


for (int j = 0; j < m; j++)


mat[i][j] = rand() % 21 - 10;


for (int i = 0; i < n; i++)


{


for (int j = 0; j < m; j++)


printf("%d ", mat[i][j]);


printf("\n");


}


printf("Cтала:\n ");


for (int i = 0; i < n; i++)


{


int* temp = new int[n];


temp[i] = mat[n - 1][i];


mat[n - 1][i] = mat[i][0];


mat[i][0] = temp[i];


}


for (int i = 0; i < n; i++)


{


for (int j = 0; j < m; j++)


printf("%d ", mat[i][j]);


printf("\n");


}


return 0;


}
Please enter comments
Please enter your name.
Please enter the correct email address.
You must agree before submitting.

Answers & Comments


Copyright © 2025 SCHOLAR.TIPS - All rights reserved.