C++ #include<iostream> using namespace std; #include<math.h> int main() { setlocale(LC_ALL, "Russian"); float x, y, p,step,end; std::cout << "Введите режим работы: 0 - ручной, 1 - цикл" <<endl<<"p="; std::cin >> p; while (p < 2) { if (p == 0) { std::cout << "Введите x="; cin >> x; if (x < -7||x>11) { std::cout << "eror"<<endl; } else { if (-7 >= x || x <= -3) { y = 3; } else if (-3 >= x || x <= 3) { y = sqrt(9 - x * x); } else if (3 >= x || x <= 6) { y = -2 * x + 9; } else if (6 >= x || x <= 11) { y = x - 9; } std::cout << "y=" << y << endl; } if (p == 1) { x= -7; end = 11; std::cout << "Введите шаг"; std::cin >> step; for (int i = x; i <= end; i = i + step) { if (-7 >= x || x <= -3) { y = 3; } else if (-3 >= x || x <= 3) { y = sqrt(9 - x * x); } else if (3 >= x || x <= 6) { y = -2 * x + 9; } else if (6 >= x || x <= 11) { y = x - 9; } std::cout <<x; std:: cout<< " | "; std::cout << y <<endl; std::cout <<"----------------"<<endl; } } } std::cout << "Для продолжения введи 0" << endl; std::cout << "Для прокрутки цикла введи 1" << endl; std::cout << "Чтобы закончить введи 2" << endl; std::cin >> p; } } C #include<iostream> using namespace std; #include<math.h> int main() { setlocale(LC_ALL, "Russian"); float x, y, p,step,end; std::cout << "Введите режим работы: 0 - ручной, 1 - цикл" <<endl<<"p="; std::cin >> p; while (p < 2) { if (p == 0) { std::cout << "Введите x="; cin >> x; if (x < -7||x>11) { std::cout << "eror"<<endl; } else { if (-7 >= x || x <= -3) { y = 3; } else if (-3 >= x || x <= 3) { y = sqrt(9 - x * x); } else if (3 >= x || x <= 6) { y = -2 * x + 9; } else if (6 >= x || x <= 11) { y = x - 9; } std::cout << "y=" << y << endl; } if (p == 1) { x= -7; end = 11; std::cout << "Введите шаг"; std::cin >> step; for (int i = x; i <= end; i = i + step) { if (-7 >= x || x <= -3) { y = 3; } else if (-3 >= x || x <= 3) { y = sqrt(9 - x * x); } else if (3 >= x || x <= 6) { y = -2 * x + 9; } else if (6 >= x || x <= 11) { y = x - 9; } std::cout <<x; std:: cout<< " | "; std::cout << y <<endl; std::cout <<"----------------"<<endl; } } } std::cout << "Для продолжения введи 0" << endl; std::cout << "Для прокрутки цикла введи 1" << endl; std::cout << "Чтобы закончить введи 2" << endl; std::cin >> p; } }