Seal_of_approval

P48

Nov 6th, 2014
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. #include <math.h>
  2. #include <fstream>
  3. using namespace std;
  4.  
  5. double y(double x)
  6. { if(((x-2)>0)&&((5*x+1)>0))
  7. return (log(x-2)/sqrt(5*x+1));
  8. else return 00;
  9. }
  10.  
  11. int main (void)
  12. {
  13. ifstream ins("p48.txt");
  14. ofstream ous ("ans48.txt");
  15. double a,b,h,res;
  16. ins >> a >> b >> h;
  17. for (double i=a; i<=b; i+=h)
  18. {
  19. ous << i << " ";
  20. res=y(i);
  21. if (res!=00)
  22. ous << res << endl;
  23. else ous << "no answer" << endl;
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment