Advertisement
kirya_shkolnik

C++ - Никита - 5

Jan 22nd, 2021
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. #include <cmath>
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. double func(double x,double y){
  7.     return (y * pow(cos(x),2) - exp(-x));
  8. }
  9. int VlozhCikl(double a, double b, double hx, double c, double d, double hy) {
  10.     double x, y, z;
  11.     int count = 0;
  12.     for (x = a; x <= b; x += hx) {
  13.         for (y = c; y <= d; y += hy) {
  14.             z = func(x, y);
  15.             if(z > 0) count++;
  16.         }
  17.     }
  18.     return count;
  19. }
  20.  
  21.  
  22.  
  23.  
  24. int main()
  25. {
  26.     double a,b,c,d,hx,hy;
  27.     cin >> a >> b >> hx >> c >> d >> hy;
  28.     int count = VlozhCikl(a,b,hx,c,d,hy);
  29.     cout << count;
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement