Last active
February 8, 2020 00:27
-
-
Save r3gor/d5a4b6d2498256fa6bc45228d9a5f290 to your computer and use it in GitHub Desktop.
simple animation of person walking in c++
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <windows.h> | |
using namespace std; | |
int main() { | |
char human[4][4]={ | |
" O " , | |
"/|\\", | |
" | ", | |
"/ \\", | |
}; | |
char human2[4][4]={ | |
" O " , | |
"/|\\", | |
" | ", | |
"/ |", | |
}; | |
char human3[4][4]={ | |
" O " , | |
"/|\\", | |
" | ", | |
"/| ", | |
}; | |
char human4[4][4]={ | |
" O " , | |
"/|\\", | |
" | ", | |
"/ \\", | |
}; | |
int cont = 0; | |
while(1) { | |
Sleep(300); | |
system("cls"); | |
for (int i=0;i<4;i++){ | |
for (int x=0; x<cont;x++){ | |
cout<<" "; | |
} | |
for(int j=0;j<4;j++){ | |
cout<<human[i][j]; | |
} | |
cout<<endl; | |
} | |
Sleep(300); | |
system("cls"); | |
for (int i=0;i<4;i++){ | |
cout<<" "; | |
for (int x=0; x<cont;x++){ | |
cout<<" "; | |
} | |
for(int j=0;j<4;j++){ | |
cout<<human2[i][j]; | |
} | |
cout<<endl; | |
} | |
Sleep(300); | |
system("cls"); | |
for (int i=0;i<4;i++){ | |
cout<<" "; | |
for (int x=0; x<cont;x++){ | |
cout<<" "; | |
} | |
for(int j=0;j<4;j++){ | |
cout<<human3[i][j]; | |
} | |
cout<<endl; | |
} | |
Sleep(300); | |
system("cls"); | |
for (int i=0;i<4;i++){ | |
cout<<" "; | |
for (int x=0; x<cont;x++){ | |
cout<<" "; | |
} | |
for(int j=0;j<4;j++){ | |
cout<<human4[i][j]; | |
} | |
cout<<endl; | |
} | |
cont+=4; | |
if(cont>50) cont=0; | |
} | |
} | |
/* | |
O | |
/|\ | |
| | |
/ \ | |
O | |
/|\ | |
| | |
/ | | |
O | |
/|\ | |
| | |
/| | |
O | |
/|\ | |
| | |
|\ | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment