Desenvolvedor APL
#include <windows.h>
#include <ctype.h>
#include <locale.h>
void gotoxy(int x, int y) {
COORD c;
c.X = x;
c.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), c);
}
int main() {
setlocale(LC_ALL, "ptb");
system("title Desenvolvedor APL Channel");
system("color 1f");
int x = 30, y = 10;
char ch;
gotoxy(x, y);
printf("Desenvolvedor APL");
while(1) {
ch = getch();
switch(ch) {
case 75: /**Direção: Para Esquerda*/
x--;
break;
case 77: /**Direção: Para Direita*/
x++;
break;
case 72: /**Direção: Para Cima*/
y--;
break;
case 80: /**Direção: Para Baixo*/
y++;
break;
case 27:
exit(0);
}
system("cls");
gotoxy(x, y);
printf("Desenvolvedor APL");
}
}
Comentários
Postar um comentário