Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <windows.h>
- using namespace std;
- int main()
- {
- SetConsoleOutputCP(1251);
- double x{};
- double &rx = x;
- while (true) {
- cout << "Введіть x: ";
- cin >> rx;
- if (cin.fail()) {
- cin.clear();
- cin.ignore(32767, '\n');
- cout << "Введене значення має бути числом. Спробуйте ще раз!" << endl;
- continue;
- }
- else {
- break;
- }
- }
- if (sin(rx) + cos(rx) < 0) {
- cout << "Неможливо обчислити корінь з числа " << sin(rx) + cos(rx);
- }
- else {
- cout << "Обчислене значення - " << sqrt(sin(rx) + cos(rx)) << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement