Advertisement
Guest User

Untitled

a guest
Oct 21st, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1. #include "pch.h"
  2. #include <iostream>
  3. #include <math.h>
  4. #include <windows.h>
  5. #include <conio.h>
  6. using namespace std;
  7. void tabulation(float, float, float);
  8. float func(float);
  9. void output(float , float);
  10.  
  11. int main()
  12. {
  13.     float a, b, h;
  14.  
  15.     cout << "Vvedit` a =\t";
  16.     cin >> a;
  17.     cout << "Vvedit` b =\t";
  18.     cin >> b;
  19.     cout << "Vvedit` h =\t";
  20.     cin >> h;
  21.  
  22.     tabulation(a, b, h);
  23.  
  24.     return 0;
  25. }
  26.  
  27. void tabulation(float a, float b, float h) {
  28.     float y, p;
  29.  
  30.     if (a >= b) {
  31.         p = a;
  32.         a = b;
  33.         b = p;
  34.     }
  35.  
  36.  
  37.     while (a <= b) {
  38.         y = func(a);
  39.         output(a, y);
  40.         a += h;
  41.     }
  42. }
  43.  
  44. float func(float a) {
  45.     return sqrt(a + 2) - sqrt(a + 3);
  46. }
  47.  
  48. void output(float a, float b) {
  49.     cout << "x = " << a << "\t\t" << "y = " << b << endl;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement