princess82
13.03.2021 18:39

сделать так чтобы в этом коде использовались указатели вместо вместо масива. С++ #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;

}

Нажмите на рекламу ниже и сразу увидите ответ
Популярные вопросы:
Ответ:
dvladimirov425
28.01.2020 15:43
Написал на VBS, тот же бейсик, который есть в школах

dim years
years = inputbox("Введите ваш возраст")
if years = 1 then msgbox("Мне 1 год") end if
if years = 2 then msgbox("Мне 2 годa") end if
if years = 3 then msgbox("Мне 3 годa") end if
if years = 4 then msgbox("Мне 4 годa") end if
if (years >= 5) and (years <= 19) then msgbox("Мне "+cstr(years)+" лет") end if

if years >= 20 then
dim s
s = "Мне "+cstr(years)
if (years mod 10 = 1) then s = s + " год" end if
if (years mod 10 >= 2) and (years mod 10 <= 4) then s = s + " годa" end if
if (years mod 10 >= 5) and (years mod 10 <= 9) then s = s + " лет" end if
if (years mod 10 = 0) then s = s + " лет" end if
msgbox(s)
end if
0,0(0 оценок)
Ответ:
28.01.2020 15:43
Что-то меня глючит. Я же вроде как отвечал...

dim years
years = inputbox("Введите ваш возраст")
if years = 1 then msgbox("Мне 1 год") end if
if years = 2 then msgbox("Мне 2 годa") end if
if years = 3 then msgbox("Мне 3 годa") end if
if years = 4 then msgbox("Мне 4 годa") end if
if (years >= 5) and (years <= 19) then msgbox("Мне "+cstr(years)+" лет") end if

if years >= 20 then
dim s
s = "Мне "+cstr(years)
if (years mod 10 = 1) then s = s + " год" end if
if (years mod 10 >= 2) and (years mod 10 <= 4) then s = s + " годa" end if
if (years mod 10 >= 5) and (years mod 10 <= 9) then s = s + " лет" end if
if (years mod 10 = 0) then s = s + " лет" end if
msgbox(s)
end if

VBS
0,0(0 оценок)
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota Оформи подписку
logo
Начни делиться знаниями
Вход Регистрация
Что ты хочешь узнать?
Спроси ai-бота