begin writeln('Введите два положительных числа'); readln(x, y); writeln('Введите код операции от 1 до 4'); readln(n); case n of 1: begin rx := sin(x); ry := sin(y); s := 'sinX' end; 2: begin rx := cos(x); ry := cos(y); s := 'cosX' end; 3: begin rx := tan(x); ry := tan(y); s := 'tgX' end; 4: begin rx := 1 / tan(x); ry := 1 / tan(y); s := 'ctgX' end; else begin rx := 0; ry := 0; s := '???' end end; writeln('Результаты для ', s, ': ', rx, ', ', ry) end.
Тестовое решение:
Введите два положительных числа 4 5 Введите код операции от 1 до 4 2 Результаты для cosX: -0.653643620863612, 0.283662185463226
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <ctime>
using namespace std;
int n, i;
int main() {
vector <int> x;
cin >> n;
srand(time(0));
for (; i < n; ++i) {
x.emplace_back(rand());
}
for (i = 0; i < n; ++i) {
cout << x[i] << " ";
}
cout << endl;
sort(x.begin(), x.end());
for (i = 0; i < n; ++i) {
cout << x[i] << " ";
}
return 0;
}