Bonjour à tous,
J'apprends le pascal pour le plaisir personnel et je me suis attaqué depuis ce matin au readkey.
Voici mon code source,
Il fonctionne mais étant débutant, pouvez vous me dire s'il est fait de manière optimal?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 Program readkeytest; Uses crt; Var x,y: byte; mv: char; Begin cursoroff; x:=40; y:=10; While not(keypressed) do Begin GotoXY (x,y); If (mv='q') OR (mv='d') then WriteLn ('--'); If (mv='z') OR (mv='s') then WriteLn ('|'); mv:=readkey; If (mv='q') AND (x>1) then x:=x-1; If (mv='d') AND (x<78) then x:=x+1; If (mv='z') AND (y>1) then y:=y-1; If (mv='s') AND (y<24) then y:=y+1; clrscr; End; ReadLn End.
Merci à tous de m'aidez au plus vite.
Partager