Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. int A[5][5];
  5.  
  6. void clear(){
  7. for(int i=0; i<5; i++){
  8. for(int j=0; j<5; j++){
  9. A[i][j] = 0;
  10. }
  11. }
  12. }
  13.  
  14. void show(){
  15. for(int i=0; i<5; i++){
  16. for(int j=0; j<5; j++){
  17. cout << A[i][j];
  18. }
  19. cout<<endl;
  20. }
  21. cout<<endl;
  22. }
  23.  
  24. int main(){
  25. clear();
  26. show();
  27.  
  28. int x1=0, y1=0;
  29. int x2=0, y2=0;
  30. int x3=0, y3=0;
  31. int x4=0, y4=0;
  32.  
  33. int x1p=0, y1p=0;
  34. int x2p=0, y2p=0;
  35. int x3p=0, y3p=0;
  36.  
  37. int op;
  38. cin>>op;
  39. cout<<endl;
  40.  
  41. while(op != 0){
  42. if(op == 1){
  43.  
  44. x1p=x1; y1p=y1;
  45. x2p=x2; y2p=y2;
  46. x3p=x3; y3p=y3;
  47.  
  48. x2=x1p; y2=y1p;
  49. x3=x2p; y3=y2p;
  50. x4=x3p; y4=y3p;
  51.  
  52. A[y1][x1] = 1;
  53. A[y2][x2] = 1;
  54. A[y3][x3] = 1;
  55. A[y4][x4] = 1;
  56.  
  57. show();
  58. clear();
  59.  
  60. if(x1==0 && y1!=0){
  61. y1--;
  62. }
  63. else if(x1!=4 && y1!=4){
  64. x1++;
  65. }
  66. else if(x1==4 && y1!=4){
  67. y1++;
  68. }
  69. else if(x1!=0 && y1==4){
  70. x1--;
  71. }
  72. }
  73. //cin>>op;
  74. //cout<<endl;
  75. system("cls");
  76. }
  77.  
  78. return 0;
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement