Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int x0,x1,h,z;
- char com;
- void cikl1(int x0,int x1,int h,int z)
- {
- int buf;
- z=0;
- int x=0;
- x=x0;
- while(x!=x1)
- {
- buf=sin(x);
- if (buf>0.5)
- {z=0.5;}
- else
- {if (buf<-0.5)
- {z=-0.5;}
- else
- {z=sin(x);}}
- cout<<"z "<<z<<endl;
- x=x0+(x1-x0)/h;
- }
- }
- int main()
- {
- do
- {
- cout<<"Please, print x0,x1,h"<<endl;
- cin>>x0;
- cin>>x1;
- cin>>h;
- cikl1(x0,x1,h,z);
- cout<<"Do you like to try again?"<<endl;
- cin>>com;
- }while(com=='y'||com=='Y');
- return 0;
- }
Add Comment
Please, Sign In to add comment