bigman4
04.05.2023 00:01

Определите, для чего предназначены данные команды
блоков, запишите ответы в тетрадях.
Команды блоков
Функции
говорить Прироrl в течение 2 секунд
думать Ммм... (2 секунд
думать Ммм... )
сказать Привет!​

Нажмите на рекламу ниже и сразу увидите ответ
Популярные вопросы:
Ответ:
frolovbogdan122
01.11.2020 04:01

Код:

#include <iostream>

#include <string>

using namespace std;

void printArray(int** arr, size_t X, size_t Y) {

   for (size_t i = 0; i < X; ++i) {

       for (size_t j = 0; j < Y; ++j) {

           cout << arr[i][j] << " ";

       }

       cout << endl;

   }

}

int main() {

   size_t X, Y;

   cout << "Number of rows in the array: ";

   cin >> X;

   cout << "Elements in each row of the array: ";

   cin >> Y;

   int** arr = new int* [X];

   for (size_t i = 0; i < X; ++i) {

       arr[i] = new int[Y];

       cout << "#" << i + 1 << ": ";

       for (size_t j = 0; j < Y; ++j)

           cin >> arr[i][j];

   }

   size_t index;

   cout << "index to check the row for non-decreasing ordering: ";

   cin >> index;

   --index; // numbering from 1

   bool flag = 1;

   for (int i = 0; i < Y - 1; ++i) {

       if (!(arr[index][i] <= arr[index][i + 1])) {

           cout << "No, " << i + 1 << (i + 1 == 1 ? "st" : (i + 1 == 2 ? "nd" : (i + 1 == 3) ? "rd" : "th")) << " element (" << arr[index][i] << ") violates the non-decreasing ordering (" << arr[index][i] << " > " << arr[index][i + 1] << ").\n";

           flag = 0;

           break;

       }

   }

   if (flag)

       cout << "Yes, the specified row is ordered in non-decreasing order.\n";

   flag = 1;

   index = 1;

   cout << "index to check the column for non-increasing ordering: ";

   cin >> index;

   --index;

   flag = 1;

   for (int i = 0; i < X - 1; ++i) {

       if (!(arr[i][index] >= arr[i + 1][index])) {

           cout << "No, " << i + 1 << (i + 1 == 1 ? "st" : (i + 1 == 2 ? "nd" : (i + 1 == 3) ? "rd" : "th")) << " element (" << arr[i][index] << ") violates the non-increasing ordering (" << arr[i][index] << " < " << arr[i][index + 1] << ").\n";

           flag = 0;

           break;

       }

   }

   if (flag)

       cout << "Yes, the specified row is ordered in non-increasing order.\n";

}


Нужна с задачей! Буду рад за ! Задачу надо решить с С++. 12.141. Дан двумерный массив. Составить про
Нужна с задачей! Буду рад за ! Задачу надо решить с С++. 12.141. Дан двумерный массив. Составить про
Нужна с задачей! Буду рад за ! Задачу надо решить с С++. 12.141. Дан двумерный массив. Составить про
0,0(0 оценок)
Ответ:
оопда
02.08.2022 10:08

Листинг 1:

program sum_cubes;

(c) NaaMan}

 function func(x: real): real;

 begin

   Result := 3*x*x + 3*sin(x);

 end;

 const

   start = 0.0;

   finish = 5.0;

   step = 0.7;

 var

   sum, i: real;

   n: integer;

begin

 sum := 0;

 n := 0;

 i := start;

 while i <= finish do begin

   var y: real;

   y := func(i);

   writeln(i,'   ', y:8:3);

   if y > 0 then begin

     sum := sum + power(y,3);

     n := n + 1;

   end;

   i := i + step;

 end;

 writeln( 'Sum = ', sum:10:3, '   Count = ', n);

end.

Листинг 2:

program arr_sum_cou;

(c) NaaMan}

var

 sum, n: integer;

begin

 sum := 0;

 n := 0;

 var a := ArrRandomInteger(100, -40, 40);

 foreach var i in a do

   if i < 0 then

     sum := sum + i

   else

     n := n + 1;

 writeln('Array: ', a);

 writeln( 'Sum = ', sum, '   Count = ', n);

end.

Листинг 3:

program arr_sum_cou;

(c) NaaMan}

var F: boolean;

begin

 F := True;

 var A := ArrRandomInteger(10, 1, 10);

 var B := ArrRandomInteger(10, 1, 10);

 writeln(A);

 writeln(B);

 for var i := 0 to 9 do

   if A[i] = B[i] then begin

     writeln('Item = ', i, '   Value = ', A[i]);

     F := False;

   end;

   if F then

     writeln('Совпадений нет.');

end.


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