#include using namespace std; int main() { setlocale(LC_CTYPE, "Russian"); double a = 2.8, b = (-0.3), c = 4, x, w; int j = 0; // 1. for cout << "Цикл for:\n"; for (x = 1; x < 2.01; x += 0.05) { j += 1; if (x < 1.2) { w = a*pow(x, 2) + b*x + c; } if (x == 1.2) { w = a / x + sqrt(pow(x, 2) + 1); } if (x > 1.2) { w = (a + b*x) / (sqrt(pow(x, 2) + 1)); } cout << "x=" << x; if (j % 2 != 0) cout << ' '; if (j == 1 || j == 21) cout << " "; cout<< " w=" << w << '\n'; } // 2.while x = 1; j = 0; cout << "\n\nЦикл while:\n"; while (x < 2.1) { j += 1; if (x < 1.2) { w = a*pow(x, 2) + b*x + c; } if (x == 1.2) { w = a / x + sqrt(pow(x, 2) + 1); } if (x > 1.2) { w = (a + b*x) / (sqrt(pow(x, 2) + 1)); } cout << "x=" << x; if (j % 2 != 0) cout << ' '; if (j == 1 || j == 21) cout << " "; cout << " w=" << w << '\n'; x += 0.05; } system("pause"); return 0; }