М
Молодежь
К
Компьютеры-и-электроника
Д
Дом-и-сад
С
Стиль-и-уход-за-собой
П
Праздники-и-традиции
Т
Транспорт
П
Путешествия
С
Семейная-жизнь
Ф
Философия-и-религия
Б
Без категории
М
Мир-работы
Х
Хобби-и-рукоделие
И
Искусство-и-развлечения
В
Взаимоотношения
З
Здоровье
К
Кулинария-и-гостеприимство
Ф
Финансы-и-бизнес
П
Питомцы-и-животные
О
Образование
О
Образование-и-коммуникации
alena1706
alena1706
13.06.2022 01:47 •  Информатика

Составить программу на загадку почему осенью птицы улетают на юг

👇
Ответ:
Лилия2073
Лилия2073
13.06.2022
Вобще птицы улетают на юг, потому что им холодно здесь зимой и мало еды.
4,4(45 оценок)
Открыть все ответы
Ответ:
lavlln
lavlln
13.06.2022

Задание 1:

using namespace std;

#include <iostream>

#include <clocale>

#include <cstdlib>

#include <iomanip>

#include <string>

#include <ctime>

int main() {

setlocale(LC_ALL, "rus");

system("chcp 1251");

srand(time(0));

 

int N = rand() % 6 + 5;

int pos = 0, neg = 0, max = -20, min = 20, maxind, minind;

int* mass = new int[N];

cout << "Массив:" << endl;

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

 mass[i] = rand() % 41 - 20;

 if (mass[i] > 0) pos++;

 if (mass[i] < 0) neg++;

 if (mass[i] > max) {

  max = mass[i];

  maxind = i;

 }

 if (mass[i] < min) {

  min = mass[i];

  minind = i;

 }

 cout << setw(3) << mass[i];

}

cout << endl << endl;

if (pos > neg) {

 swap(mass[maxind], mass[minind]);

 cout << "Измененный массив:" << endl;

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

  cout << setw(3) << mass[i];

 }

}

else cout << "Массив не изменился";

cout << endl;

 

delete[] mass;

system("pause");

return 0;

}

Задание 2:

using namespace std;

#include <iostream>

#include <clocale>

#include <cstdlib>

#include <iomanip>

#include <string>

#include <ctime>

int main() {

setlocale(LC_ALL, "rus");

system("chcp 1251");

srand(time(0));

 

int N = rand() % 6 + 5;

int max = -20, min = 20, maxind, minind;

int* mass = new int[N];

cout << "Массив:" << endl;

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

 mass[i] = rand() % 41 - 20;

 if (mass[i] > max) {

  max = mass[i];

  maxind = i;

 }

 if (mass[i] < min) {

  min = mass[i];

  minind = i;

 }

 cout << setw(3) << mass[i];

}

cout << endl << endl;

if (abs(minind - maxind) == 1) {

 cout << "Измененный массив:" << endl;

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

  if (mass[i] < 0) mass[i] = 0;

  cout << setw(3) << mass[i];

 }

}

else cout << "Массив не изменился";

cout << endl;

 

delete[] mass;

system("pause");

return 0;

}

4,8(57 оценок)
Ответ:
andrew120885p09zsu
andrew120885p09zsu
13.06.2022

<!DOCTYPE html>

<html lang="en">

<head>

   <meta charset="utf-8">

   <style type="text/css">

       #circle {

           border-radius: 100px;

           width: 100px;

           height: 100px;

           position: absolute;

           top: 50%;

           left: 50%;

           transform: translate(-50%, -50%);

           cursor: pointer;

       }

       #circle.red {

           background-color: red;

       }

       #circle.green {

           background-color: green;

       }

       #circle.orange {

           background-color: orange;

       }

   </style>

   <title>Title</title>

</head>

<body>

<div id="circle" class="red"></div>

<скрипт>

   colors = ["red", "green", "orange"]

   document.getElementById("circle").addEventListener("click", function(e) {

       const element = this;

       let currentColor = element.classList.value

       if (currentColor === "orange"){

           currentColor = colors[0]

       } else {

           currentColor = colors[colors.indexOf(currentColor)+1]

       }

       element.classList = currentColor

   })

</скрипт>

</body>

</html>

P.S. При загрузке фулл кода выдает ошибку от сайта.. Поэтому на фотке весь код


создайте страничку с красным кружком (100х100) и напишите скрипт который будет при каждом клике на к
4,5(86 оценок)
Новые ответы от MOGZ: Информатика
logo
Вход Регистрация
Что ты хочешь узнать?
Спроси Mozg
Открыть лучший ответ