online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include <ncurses.h> #include <ctype.h> #include <unistd.h> struct vetor2 { int x, y; }; int main(void) { int tecla; struct vetor2 vetor = {1, 1}; initscr(); /* inicia a ncurses */ noecho(); /* Não deixa o caractere pressionado aparecer */ cbreak(); /* Não espera que seja pressionado enter */ do { clear(); /* Apaga a tela */ printw("Utilize as teclas WASD para se mover, e X para sair\n"); tecla = getch(); /* pega uma tecla */ switch (toupper(tecla)) { case 'A': if (vetor.x > 0) { vetor.x--; } else { vetor.x = 79; } break; case 'D': if (vetor.x < 79) { vetor.x++; } else { vetor.x = 0; } break; case 'W': if (vetor.y > 0) { vetor.y--; } else { vetor.y = 20; } break; case 'S': if (vetor.y < 20) { vetor.y++; } else { vetor.y = 0; } break; } move(vetor.y, vetor.x); printw("#"); refresh(); /* Atualiza a tela */ usleep(50000); /* Faz uma pausa de 50 msec */ } while (toupper(tecla) != 'X'); endwin(); /* finaliza a ncurses */ return(0); }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue