Guest User

Untitled

a guest
Oct 21st, 2019
84
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ВАРИАНТ 26
  2. //
  3.  
  4. #include <iostream>
  5. #include <stdio.h>
  6. #include <math.h>
  7.  
  8. using namespace std;
  9.  
  10. double getFunctionResult(double x, double a) {
  11. return (2 * x / (sqrt(0.2 * a + cos(x / 2 + a))));
  12. }
  13.  
  14. int main() {
  15. setlocale(LC_ALL, "Russian");
  16.  
  17. char arr[] = "ОШИБКА!";
  18. const double X = -0.9, XX = 4.1, XXX = 0.5;
  19. double a, x;
  20. int L = (XX - X) / XXX;
  21.  
  22. x = X;
  23.  
  24. cout << "ВВЕДИТЕ A: \n ";
  25. cin >> a;
  26.  
  27. printf("-----------------------------------------------------------\n");
  28. printf(" | A | FUNCTION | X |\n");
  29. printf("-----------------------------------------------------------\n");
  30.  
  31. for (int k = 0; k < L; k = k + 1) {
  32. while (x != XX) {
  33. if (2 * x / (sqrt(0.2 * a + cos(x / 2 + a))) == 0) {
  34. printf("| %6.2f | %25.2s | %17.5s |\n", a, x, arr);
  35. } else {
  36. printf("| %6.2f | %25.2f | %17.5f |\n", a, x, getFunctionResult(x, a));
  37. }
  38.  
  39. x = x + XXX;
  40. }
  41. }
  42.  
  43. printf("-----------------------------------------------------------\n");
  44. return 0;
  45. }
RAW Paste Data