Guest User

Untitled

a guest
Apr 26th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4. int x0,x1,h,z;
  5. char com;
  6. void cikl1(int x0,int x1,int h,int z)
  7. {
  8. int buf;
  9. z=0;
  10. int x=0;
  11. x=x0;
  12. while(x!=x1)
  13. {
  14. buf=sin(x);
  15. if (buf>0.5)
  16. {z=0.5;}
  17. else
  18. {if (buf<-0.5)
  19. {z=-0.5;}
  20. else
  21. {z=sin(x);}}
  22. cout<<"z "<<z<<endl;
  23. x=x0+(x1-x0)/h;
  24. }
  25. }
  26. int main()
  27. {
  28. do
  29. {
  30. cout<<"Please, print x0,x1,h"<<endl;
  31. cin>>x0;
  32. cin>>x1;
  33. cin>>h;
  34. cikl1(x0,x1,h,z);
  35. cout<<"Do you like to try again?"<<endl;
  36. cin>>com;
  37.  
  38. }while(com=='y'||com=='Y');
  39. return 0;
  40. }
Add Comment
Please, Sign In to add comment