Advertisement
Maksud3

Lab4(VZ)

May 25th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.02 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <iostream>
  3. #include <math.h>
  4. #include <locale.h>
  5.  
  6. int main(void)
  7. {
  8.     setlocale(LC_ALL, "Ukr");
  9.  
  10.     const double K = 5.498, L = 0.995, M = 3.14;
  11.     double x, y, a, b;
  12.  
  13.     printf("\t+------------------|------------------|------------------|------------------+\n");
  14.     printf("\t|\ta = \t\t    b = \t\tx = \t\t  y = \t    |\n");
  15.     printf("\t+------------------|------------------|------------------|------------------+\n");
  16.  
  17.     for (int i = 0; i < 3; i++)
  18.     {
  19.         if (i == 0)
  20.         {
  21.             x = 3.47;
  22.         }
  23.         else if (i == 1)
  24.         {
  25.             x = 0.249;
  26.         }
  27.         else
  28.         {
  29.             x = -0.249;
  30.         }
  31.  
  32.         if (x <= 0)
  33.         {
  34.             a = K;
  35.             b = NULL;
  36.         }
  37.         else
  38.         {
  39.             a = (K - (pow(x, 1. / 3) / 4.0));
  40.             b = L + tan(log(x)) + 2 * M;
  41.         }
  42.  
  43.         if (a >= b)
  44.         {
  45.             y = log(a - b);
  46.         }
  47.         else
  48.         {
  49.             y = log(b - a);
  50.         }
  51.  
  52.         printf("\t|    %8.2lf\t\t%8.2lf\t   %8.2lf\t     %8.2lf\t    |\n", a, b, x, y);
  53.     }
  54.     printf("\t+------------------|------------------|------------------|------------------+\n");
  55.  
  56.     system("pause");
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement