Correction Exemple Cours MVaP
This commit is contained in:
parent
cc6c2f49f9
commit
56d47ef786
42
MVaP/ExoCours.mvap
Normal file
42
MVaP/ExoCours.mvap
Normal file
@ -0,0 +1,42 @@
|
||||
# Exo.
|
||||
# j = 1
|
||||
# i = 0
|
||||
# i = j
|
||||
# while i < 10:
|
||||
# i += 1
|
||||
# print(i)
|
||||
#
|
||||
# étapes par étapes ci-dessous
|
||||
#
|
||||
# j = 1
|
||||
PUSHI 1 ### j habite à l'adresse 0
|
||||
# i = 0
|
||||
PUSHI 0 ### i habite à l'adresse 1
|
||||
# i = j
|
||||
PUSHG 0 ### récupère j
|
||||
STOREG 1 ### affecte à i cette valeur
|
||||
|
||||
LABEL 12
|
||||
|
||||
# test i<10 ?
|
||||
PUSHG 1 ### récupère i
|
||||
PUSHI 10 ### pousse 10
|
||||
INF ### <?
|
||||
#
|
||||
JUMPF 34
|
||||
# i += 1
|
||||
PUSHG 1
|
||||
PUSHI 1
|
||||
ADD
|
||||
STOREG 1
|
||||
#
|
||||
JUMP 12
|
||||
LABEL 34
|
||||
#La suite
|
||||
# print(i)
|
||||
PUSHG 1
|
||||
WRITE
|
||||
POP
|
||||
POP
|
||||
POP
|
||||
HALT
|
Loading…
Reference in New Issue
Block a user