Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2014
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <cstdint>
  4. #include <math.h>
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10. setlocale(LC_ALL, "Russian");
  11. float x, y;
  12. cout « endl « " | x |" « "| y |" « endl;
  13. cout « " |---------|" « "|---------|" « endl;
  14. for (x=0; x<20; x+=0.25)
  15. {
  16. if (x < 2)
  17. {
  18. y = 2-x;
  19. }
  20. else if (x<4)
  21. {
  22. y = 2*(sqrt(1-(x-2)*(x-2)));
  23. }
  24. else if ( fmod(x,4) < 2)
  25. {
  26. y = 2-(fmod(x,4);
  27. }
  28. else if ( fmod(x,4) < 4)
  29. {
  30. y = 2*(sqrt(1-((fmod(x,4)-2)*((fmod(x,4)-2)));
  31. }
  32. cout « " | "« x « " |" « "| "« y « " |" « endl;
  33. }
  34. system("pause");
  35. return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement