Advertisement
Zennoma

Dz ukazatel

Dec 8th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.84 KB | None | 0 0
  1. #include <math.h>
  2. #include <stdio.h>
  3. #include <locale.h>
  4.  
  5. float (*funnik)(float);
  6.  
  7. float f1(float x)
  8. {
  9.     return x * sin(x);
  10. }
  11.  
  12. float f2(float x)
  13. {
  14.     return tan(x);
  15. }
  16.  
  17. float MASSHTAB(float(*funnik)(float),int B)
  18. {
  19.     float M;
  20.     float y;
  21.     float  k, max,x;
  22.     max = -100;
  23.     for (x = -1; x <= 1; x += 0.2)
  24.     {
  25.         y = funnik(x);
  26.         if (y > max)
  27.             max = y;
  28.     }
  29.     M = B / max;
  30.     return (M);
  31. }
  32.  
  33. int main()
  34. {
  35.    
  36.     float M, B;
  37.     setlocale(LC_ALL,"rus");
  38.     puts("Введите размер экрана в растрах для поиска масштаба функций");
  39.     scanf_s("%f", &B);
  40.     printf_s("Масштаб графического изображения функции 1 = %5.2f \n", MASSHTAB(f1, B));
  41.     printf_s("Масштаб графического изображения функции 2 = %5.2f \n", MASSHTAB(f2, B));
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement