Seal_of_approval

P49

Nov 6th, 2014
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4. double y(double x)
  5. {
  6. if ((x>=0)&&(x!=1)) return (-1/(1-x));
  7. else if ((x<0)&&(x!=-1)) return (1/(1+x));
  8. else return 1;
  9. }
  10. int main (void)
  11. {
  12. ifstream ins("p49.txt");
  13. ofstream ous("ans49.txt");
  14. double a,b,h;
  15. ins >> a >> b >> h;
  16. for (double i=a; i<=b; i+=h)
  17. ous << i << " " << y(i) << endl;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment