Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int A[5][5];
- void clear(){
- for(int i=0; i<5; i++){
- for(int j=0; j<5; j++){
- A[i][j] = 0;
- }
- }
- }
- void show(){
- for(int i=0; i<5; i++){
- for(int j=0; j<5; j++){
- cout << A[i][j];
- }
- cout<<endl;
- }
- cout<<endl;
- }
- int main(){
- clear();
- show();
- int x1=0, y1=0;
- int x2=0, y2=0;
- int x3=0, y3=0;
- int x4=0, y4=0;
- int x1p=0, y1p=0;
- int x2p=0, y2p=0;
- int x3p=0, y3p=0;
- int op;
- cin>>op;
- cout<<endl;
- while(op != 0){
- if(op == 1){
- x1p=x1; y1p=y1;
- x2p=x2; y2p=y2;
- x3p=x3; y3p=y3;
- x2=x1p; y2=y1p;
- x3=x2p; y3=y2p;
- x4=x3p; y4=y3p;
- A[y1][x1] = 1;
- A[y2][x2] = 1;
- A[y3][x3] = 1;
- A[y4][x4] = 1;
- show();
- clear();
- if(x1==0 && y1!=0){
- y1--;
- }
- else if(x1!=4 && y1!=4){
- x1++;
- }
- else if(x1==4 && y1!=4){
- y1++;
- }
- else if(x1!=0 && y1==4){
- x1--;
- }
- }
- //cin>>op;
- //cout<<endl;
- system("cls");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement