#include #include #include #include #include #include #include using namespace std; int ppos,bh,b,dir,i,num; int sizey,sizex; char key; int getrand(int min,int max){ return(rand()%(max-min)+min); } void line(int m,int b) { if (m==1) { cout << "|"; } else if (m==0) { cout << " " ; } for (i=0;ibh) { for (i=0;i<5-ppos;i++) { cout << " |" << endl; } cout << "| |" << endl; for (i=0;i=sizey||bh==1){ if (dir==2){ dir=3; } else if (dir==-2){ dir=-3; } else if (dir==3){ dir=2; } else if (dir==-3){ dir=-2; } } print(ppos,bh,b); cout << "ppos = " << ppos << " ; bh = " << bh << " b = " << b << endl; if (kbhit()) { key=getch(); if (key=='w') { if (ppos<5){ ppos=ppos+1; menu(0,ppos,bh,b); } } else if (key=='s'){ if (ppos>1){ ppos=ppos-1; menu(0,ppos,bh,b); } } } Sleep(1000); main(); return EXIT_SUCCESS; }