Guest User

Untitled

a guest
Nov 20th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. //задача про ромбики(попадает ли точка в ромб)(еще на паре решила давно)
  2. #include<iostream>
  3. #include <locale.h>
  4. using namespace std;
  5. int main(void){
  6. setlocale(LC_ALL, "Russian");
  7. double x,y,a,b;
  8. cout<<"ВВедите x,y,a,b"<<"\n";
  9. cin>>x>>y>>a>>b;
  10. x=x-2*a*((int)(x/(2*a)));
  11. y=y-2*b*((int)(y/(2*b)));
  12. x>=0?x:-x;
  13. y>=0?y:-y;
  14. if (y<=b-(b/a)*x)
  15. cout<<"Да \n";
  16. else
  17. cout<<"Нет \n";
  18. system("pause");
  19. return 0;
  20. }
Add Comment
Please, Sign In to add comment