momot06
21.01.2020 15:01

Построить таблицу истинности и чёт про высказывания


Построить таблицу истинности и чёт про высказывания

Нажмите на рекламу ниже и сразу увидите ответ
Популярные вопросы:
Ответ:
Hellybery
02.05.2022 10:28
На Паскале:

program Program1;
var i, j, n, k: integer;
var result: real;
var array1: array [1..255] of real;
begin
     result := 0;
     write('Введите значение N (не более 255): ');
     readln(n);
     for i := 1 to n do
         begin
          write('Введите значение ', i, ' элемента массива: ');
          readln(array1[i]);
         end;
         begin
          writeln('Массив, размером - ', n, ' элементов(а):');
          for i := 1 to n do write(array1[i], ' ');
          writeln;
         end;
     for i:=1 to n do
         begin
          k := 0;
          for j:=1 to n do
          if array1[i] = array1[j] then k := k + 1;
          if k = 1 then result := result + array1[i];
         end;
     writeln('Сумма уникальных элементов массива = ', result);
end.
0,0(0 оценок)
Ответ:
Кирюха33333
04.03.2021 00:41
#1:
#include <iostream>
#include <ctime>

int main()
{
  srand(time(NULL));

  const int arraySize = 10;
  int mainArray[arraySize];  
  
  for (int i = 0; i < arraySize; i++)
    mainArray[i] = rand() % 1000;
  
  int maxNum = mainArray[0];
  for (int i = 0; i < arraySize; i++)
    if (mainArray[i] > maxNum)
      maxNum = array[i];
  
  std::cout << maxNum << std::endl;

  system("pause");
  return 0;
}

#2:
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
  float
    a_coef,
    b_coef,
    c_coef;

  cout << "Input the coefficients (a * x^2 + b * x + c): ";
  cin >> a_coef >> b_coef >> c_coef;
  
  float res1, res2;
  
  res1 = (-b_coef + sqrt(b_coef * b_coef - 4 * a_coef * c_coef)) / (2 * a_coef);
  res2 = (-b_coef - sqrt(b_coef * b_coef - 4 * a_coef * c_coef)) / (2 * a_coef);
  
  cout << res1 << "; " << res2 << endl;

  system("pause");
  return 0;
}

#3:
#include <iostream>
#include <ctime>

int main()
{
  srand(time(NULL));
  int
    unknownNumber = rand() % 100 - 50,
    attempts = 0,
    inputtedNumber;

  while (true)
  {
    attempts++;

    cout << "Input the number: ";
    cin >> inputtedNumber;
    
    if (inputtedNumber != unknownNumber)
      cout << "Incorrect answer! Try again!" << endl;
    else
      break;
  }

  cout << "Attempts: " << attempts;
  
  system("pause");
  return 0;
}
0,0(0 оценок)
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota Оформи подписку
logo
Начни делиться знаниями
Вход Регистрация
Что ты хочешь узнать?
Спроси ai-бота