Guest User

Untitled

a guest
Dec 18th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.30 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<conio.h>
  3. #include<math.h>
  4. #include<windows.h>
  5.  
  6. int main ()
  7. {
  8.     double x, x1, dx, y;
  9.     int K,S;
  10.     system("cls");
  11.     printf("Vvudute nuznuy granizhy x0=");
  12.     scanf("%lf", &x);
  13.    
  14.     printf("Vvedite nuznuy granuzhy x1=");
  15.     scanf("%lf", &x1);
  16.    
  17.     if(x>x1)
  18.           return 0;
  19.     printf("Vvedite wag dx=");
  20.     scanf("%lf", &dx);
  21.    
  22.     printf("Vvedite vivod");
  23.     scanf("%d", &S);
  24.    
  25.     if(dx<=0)
  26.         return 0;
  27.     K=0;
  28.    
  29.     printf("+--------------+----------------+\n");
  30.     printf("| znachenie x | znechenie f(x) |\n");
  31.     printf("+--------------+----------------+\n");
  32.    
  33.     while(x<x1)
  34.     {
  35.         if(x<-3)
  36.                 y=2*cos(x*x+1);
  37.         else if(x<=2.4)
  38.                 y=sin(x-3);
  39.         else
  40.                 y=1/x;
  41.         K++;
  42.         if(K>S)
  43.         {
  44.                 system("pause");
  45.                 system("cls");
  46.                 K=1;
  47.          
  48.                 printf("+-------------+----------------+\n");
  49.                 printf("| znachenie x | znechenie f(x) |\n");
  50.                 printf("+-------------+----------------+\n");
  51.         }
  52.        
  53.         printf("| f(%10.3lf) | =%10.3lf |\n", x, y);
  54.         x+=dx;
  55.     }      
  56. printf("Press any key to exit...");
  57. system("pause");
  58. }
Add Comment
Please, Sign In to add comment