Examen!! https://forms.gle/7iR5M2rEB7Lzg8uy7
#include <iostream> #include "gotoxy.h" #include "conio.h" #define UP 80 #define DOWN 72 #define RIGTH 77 //derecha #define LEFT 75 // class barra{ int x,y,c; public: barra():x(10),y(12),c(219){}; void pintar(){ gotoxy(x,y);cout<<(char)c; } void borrar(){ gotoxy(x,y);cout<<' '; } void mover(){ while(1){ if(kbhit()){ borrar(); char tecla=getch(); switch (tecla){ case UP: y++; break; case DOWN: y--; break; case RIGTH: x++; break; case LEFT: x--; break; } pintar(); } } } }; using namespace std; int main() { barra bar; bar.pintar(); bar.mover(); }