#include <iostream>
#include <algorithm>
#include <vector>
#include <random>
int main()
{
srand(time(NULL));
const int n = 20;
std::vector<int> arr(n);
for(int i = 0;i < n;i++)
arr[i] = -20 + rand() % 40;
}
for(const int i : arr)
std::cout << i << " ";
std::cout << std::endl;
std::sort(arr.begin(),arr.end(),[](int a,int b){ return abs(a) > abs(b); });
PROGRAM ThreeNumbers;
VAR
numberOne : DOUBLE;
numberTwo : DOUBLE;
numberThree : DOUBLE;
sum : DOUBLE;
product : DOUBLE;
average : DOUBLE;
BEGIN
WriteLn('Введите три числа:');
Write('Число 1 -->');
ReadLn(numberOne);
Write('Число 2 -->');
ReadLn(numberTwo);
Write('Число 3 -->');
ReadLn(numberThree);
sum := numberOne + numberTwo + numberThree;
product := numberOne * numberTwo * numberThree;
average := (numberOne + numberTwo + numberThree) / 3.0;
WriteLn('Сумма = ', sum:6:1);
WriteLn('Произведение = ', product:6:1);
WriteLn('Среднее = ', average:6:1);
END.
#include <iostream>
#include <algorithm>
#include <vector>
#include <random>
int main()
{
srand(time(NULL));
const int n = 20;
std::vector<int> arr(n);
for(int i = 0;i < n;i++)
{
arr[i] = -20 + rand() % 40;
}
for(const int i : arr)
{
std::cout << i << " ";
}
std::cout << std::endl;
std::sort(arr.begin(),arr.end(),[](int a,int b){ return abs(a) > abs(b); });
for(const int i : arr)
{
std::cout << i << " ";
}
}
PROGRAM ThreeNumbers;
VAR
numberOne : DOUBLE;
numberTwo : DOUBLE;
numberThree : DOUBLE;
sum : DOUBLE;
product : DOUBLE;
average : DOUBLE;
BEGIN
WriteLn('Введите три числа:');
Write('Число 1 -->');
ReadLn(numberOne);
Write('Число 2 -->');
ReadLn(numberTwo);
Write('Число 3 -->');
ReadLn(numberThree);
sum := numberOne + numberTwo + numberThree;
product := numberOne * numberTwo * numberThree;
average := (numberOne + numberTwo + numberThree) / 3.0;
WriteLn('Сумма = ', sum:6:1);
WriteLn('Произведение = ', product:6:1);
WriteLn('Среднее = ', average:6:1);
END.