Вариант 1:
using namespace std;
#include <iostream>
#include <clocale>
#include <cstdlib>
#include <iomanip>
#include <string>
int main() {
setlocale(LC_ALL, "rus");
system("chcp 1251");
srand(time(0));
double x;
cout << "Введите значение x" << endl;
cin >> x;
if (x <= 0)
cout << pow(x, 4) << endl;
if (x > 0)
cout << log10(x) << endl;
system("pause");
return 0;
}
Вариант 2:
if (x >= 2)
cout << sqrt(x) << endl;
if (x < 2)
cout << log(3 - x) << endl;
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Вариант 1:
using namespace std;
#include <iostream>
#include <clocale>
#include <cstdlib>
#include <iomanip>
#include <string>
int main() {
setlocale(LC_ALL, "rus");
system("chcp 1251");
srand(time(0));
double x;
cout << "Введите значение x" << endl;
cin >> x;
if (x <= 0)
cout << pow(x, 4) << endl;
if (x > 0)
cout << log10(x) << endl;
system("pause");
return 0;
}
Вариант 2:
using namespace std;
#include <iostream>
#include <clocale>
#include <cstdlib>
#include <iomanip>
#include <string>
int main() {
setlocale(LC_ALL, "rus");
system("chcp 1251");
srand(time(0));
double x;
cout << "Введите значение x" << endl;
cin >> x;
if (x >= 2)
cout << sqrt(x) << endl;
if (x < 2)
cout << log(3 - x) << endl;
system("pause");
return 0;
}
cout << pow(x, 4) << endl;
else
cout << log10(x) << endl;