Advertisement
Savelyev_Vyacheslav

2 laba C++

Dec 21st, 2020
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.16 KB | None | 0 0
  1. #include <conio.h>
  2. #include <math.h>
  3. #include <stdio.h>
  4. #include <windows.h>
  5. #include <iostream>
  6.  
  7. main() {
  8.     SetConsoleCP(1251);
  9.     SetConsoleOutputCP(1251);
  10.     float a, b, x, z, stepen_e, stepen_x_2;
  11.     char Error_text[] = "NET resheniay";
  12.     std::cout <<"Vvedite a: ";
  13.     std::cin >>a;
  14.     std::cout <<"Vvedite b: ";
  15.     std::cin >>b;
  16.     std::cout <<"Vvedite x: ";
  17.     std::cin >>x;
  18.     if (x<=a) {
  19.         std::cout <<"esly x<=a ";
  20.         ///////////////<vihod>
  21.         if  ((x<=a)&&(x<0)) {
  22.             std::cout <<"%s. 1",Error_text;
  23.             exit(0);
  24.         }
  25.         ///////////////</vihod>
  26.         z= log(pow(27,((float)1/3))+sqrt(x)+sin(x)+cos(x));    //pow(x,y) — x^y
  27.     }
  28.  
  29.     else if ((a<x)&&(x<b)) {
  30.         std::cout <<"esly a<x<b ";
  31.         stepen_e=cosh(x)+tanh(x);
  32.         stepen_x_2=pow(x,2);
  33.         z=  pow( (pow(tan(x),2)+1.3*exp(stepen_e)) ,  stepen_x_2);
  34.     } else if (x >= b) {
  35.         std::cout <<"esly x >= b ";
  36.         ///////////////<vihod>
  37.         if  ((x>=b)&&(x>=1))  {
  38.             std::cout <<"%s. 2",Error_text;
  39.             exit(0);
  40.         } else if  ((x>=b)&&(x<0)) {
  41.             std::cout <<"%s. 3",Error_text;
  42.             exit(0);
  43.         }
  44.         ///////////////</vihod>
  45.         z=fabs(sin(x)-0.11)*acos(x) +  pow(x, asin(x));
  46.     }
  47.     std::cout <<"REZULTAT z = %f\n",z;
  48.     return 0;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement