Marcel12311

C++ [test game][PL LANGUAGE]

Oct 15th, 2021 (edited)
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. #include <iostream>
  2. #include <windows.h>
  3.  
  4. using namespace std;
  5.  
  6. // wsporzedne X i Y na mapie
  7. int x=0,y=0;
  8. int main()
  9. {
  10. while(true){
  11.  Sleep(1000);
  12.  cout << "zapamietaj X(0-2) i Y(0-2) nie moga\n";
  13.  cout<<"przekraczac wiekszej ani mniejszej liczby od tych!\n";
  14.    if(x < 0 || x > 2 || y < 0 || y > 2 || !cin ){
  15.     cout << "Blad wspolrzednych!\n";
  16.     cin.clear();
  17.     cin.sync();
  18.    }
  19.  
  20.  
  21.     for(int i=0;i<3;i++){
  22.         for(int j=0;j<3;j++){
  23.             if (i==x && j==y)cout<<"x";
  24.             else if(i==2 && j==0)cout<<"4";
  25.             else if(i%2==0 && j%2==0)cout<<"1";
  26.             else if(i%2==0 && j%2==1)cout<<"3";
  27.             else cout <<"2";
  28.         }cout<<endl;
  29.     }
  30.  
  31.  
  32.     cout<<endl;
  33.     cout << "Podaj Wsporzedne X i Y: ";
  34.     cin >>x>>y;
  35.  
  36. }
  37.     return 0;
  38. }
  39.  
Add Comment
Please, Sign In to add comment