dina249
04.08.2022 03:50

Составить программу : "Мои любимые фильмы"
(список из 10 фильмов).
Можно выбрать вместо фильмов что-нибудь другое
(фото или скриншот программы)

Нажмите на рекламу ниже и сразу увидите ответ
Популярные вопросы:
Ответ:
tanushkako
23.01.2022 21:44
Var  
i, j, k : integer; 
 a : array [0..9,0..9] of char; 
procedure U(i,j:integer);  
var c : char; 
begin 
 c:=a[i,j]; a[i,j]:=' ';  
if (c='W')and(a[i+1,j]='B') then U(i+1,j);
  if (c='B')and(a[i+1,j]='W') then U(i+1,j); 
 if (c='W')and(a[i-1,j]='B') then U(i-1,j); 
 if (c='B')and(a[i-1,j]='W') then U(i-1,j); 
 if (c='W')and(a[i,j+1]='B') then U(i,j+1);  
if (c='B')and(a[i,j+1]='W') then U(i,j+1); 
 if (c='W')and(a[i,j-1]='B') then U(i,j-1); 
 if (c='B')and(a[i,j-1]='W') then U(i,j-1); 
end; 
begin  
assign(input,'input.txt');
reset(input); 
 assign(output,'output.txt');
 rewrite(output);  
for i:=1 to 8 do begin  for j:=1 to 8 do
 read(a[i,j]); 
 readln  
end;  
for i:=1 to 8 do
 begin 
 a[0,i]:=' '; a[9,i]:=' ';  a[i,0]:=' '; a[i,9]:=' '  
end; 
 k:=0; 
 for i:=1 to 8 do 
 for j:=1 to 8 do 
 if a[i,j]<>' ' then
begin 
 k:=k+1; U(i,j)  
end;  
write(k); 
 close(output) 
end. 
0,0(0 оценок)
Ответ:
AgeraClassik
04.12.2020 01:47

#include <iostream>

using namespace std;

int main()

{

bool firstArrMore = true;

int firstArr[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };

int firstArrLength = sizeof(firstArr) / sizeof(int);

int firstArrComposition = 1;

int secondArr[] = { 10, 11, 12, 13, 14, 15, 16 };

int secondArrLength = sizeof(secondArr) / sizeof(int);

int secondArrComposition = 1;

int min = firstArr[0];

for (int i = 0; i < firstArrLength; i++) {

 cout << firstArr[i] << " ";

 if (min > firstArr[i]) {

  min = firstArr[i];

 }

 if (firstArr[i] > 0) {

  firstArrComposition *= firstArr[i];

 }

}

cout << endl;

for (int i = 0; i < secondArrLength; i++) {

 cout << secondArr[i] << " ";

 if (min > secondArr[i]) {

  min = secondArr[i];

  firstArrMore = false;

 }

 if (secondArr[i] > 0) {

  secondArrComposition *= secondArr[i];

 }

}

cout << endl << "The most less element in ";

if (firstArrMore) {

 cout << "first array" << endl;

 cout << "Composition is " << firstArrComposition << endl;

}

else {

 cout << "second array" << endl;

 cout << "Composition is " << secondArrComposition << endl;

}

}


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