int main(void) { int antal_anslag; int i, ch, x, y; x = wherex(); y = wherey(); do { gotoxy(X, Y); if ((ch = getch()) == 0) ch = 0xFF00 + getch(); antal_anslag++;
switch (ch) { case 0x000D : // Enter pressed. break; case 0xFF48 : // Pil OP if (--Y < 1) Y = 1; break; case 0xFF50 : // Pil NED if (++Y > 24) Y = 24; break; case 0xFF4B : // Pil VENSTRE if (--X < 1) X = 1; break; case 0xFF4D : // Pil HØJRE if (++X > 80) X = 80; break; default : // Alle andre characterer. putch(ch); X = whereX(); Y = whereY() break; }; // Switch } while (ch != 0x000D); return 0; } // Main
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.