Advertisement
High_Light

popadanie tocki

Feb 6th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.85 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. bool paral(int& bx, int& by, int& cx, int& cy, int& j, int& i){
  6.     if(bx==i && j<=cy && j>=by || cy==j && j>=bx && j<=cx || by==j && i<= &&  i>= || cx==i && &&)
  7.         return 1;
  8.     return 0;
  9. }
  10. bool punct(int& ax,int& ay, int& i, int& j){
  11.             if(ax==i&&ay==j)
  12.                 return 1;
  13.             return 0;
  14. }
  15.  
  16. int main()
  17. {
  18.     int ax,ay;
  19.     int bx, cx, by, cy;
  20.     cin>>ax;
  21.     cin>>ay;
  22.     bx=1;
  23.     cx=6;
  24.     by=1;
  25.     cy=4;
  26.     if(ax>=bx && ax<=cx && ay>=by && ay<=cy){
  27.         cout<< "ok" << endl;
  28.     }
  29.     for (int j=0 ; j<20; j++){
  30.         for (int i=0; i<20; i++){
  31.             if (paral(bx,by,cx,cy,j,i)&& punct(ax,ay,i,j)){
  32.                 cout<<"# ";
  33.             }
  34.             else
  35.                 cout<<"  ";
  36.         }
  37.         cout << endl;
  38.     }
  39.     return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement