Advertisement
Guest User

Untitled

a guest
Dec 8th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. float F(float x) {
  5.     if(x <= 5) return x*x + 5;
  6.     if(x > 5 && x < 20) return 0;
  7.     if(x >= 20) return 1;
  8.    
  9.     return 0;
  10. }
  11.  
  12. void F(float x, float y) {
  13.     cout << x << '\t' << y << endl;
  14. }
  15.  
  16. int main() {
  17.     int a, b, h;
  18.    
  19.     cout << "[a; b] = ";
  20.     cin >> a >> b;
  21.    
  22.     cout << "h = ";
  23.     cin >> h;
  24.    
  25.     cout << "x" << '\t' << "f(x)" << endl;
  26.    
  27.     for(int i = a; i <= b; i+=h) {
  28.         F(i, F(i));
  29.     }
  30.    
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement