maxverypainful
Messages postés1Date d'inscriptionlundi 6 octobre 2008StatutMembreDernière intervention 6 octobre 2008
-
6 oct. 2008 à 20:10
cs_ghuysmans99
Messages postés3983Date d'inscriptionjeudi 14 juillet 2005StatutMembreDernière intervention30 juin 2013
-
3 janv. 2009 à 19:33
Bonjour, je suis nouveau en tant qu'étudiant en informatique de gestion et j'ai une question concernant un code que nous devons créer.
Il a pour but de faire choisir a l'utilisateur son titre (monsieur, madame,...) puis de lui demander son nom et son prénom et d'afficher le tout sur une seule ligne.
J'ai fais un code mais celui-ci plante, pourriez-vous m'aider?
.DATA
civil db "Quelle est votre civilité?"
db 13,10, "1. Monsieur 2.Madame 3.Mademoiselle",13,10,"$"
titre1 db "Monsieur$"
titre2 db "Madame$"
titre3 db "Madmoiselle$"
nom db "Entrez votre nom",13,10,"$"
prenom db "Entrez votre prénom",13,10,"$"
code db "0"
dataread db 50 dup (?)
dataread1 db 50 dup (?)
.CODE
main proc
mov ax,@data
mov ds,ax
mov es,ax
;invitation à rentrer sa civilité
invcivil:
mov ah, 09h
mov dx, offset civil
int 21h
;encodage de la civilité
mov ah, 01h
int 21h
mov code,al
;affichage de la civilité
mov ah, 01h
int 21h
cmp al,'1'
je titre01
cmp al,'2'
je titre02
cmp al,'3'
je titre03
titre01:
mov ah, 09h
mov dx, offset titre1
int 21h
jmp affprenom
titre02:
mov ah, 09h
mov dx, offset titre2
int 21h
jmp affprenom
titre03:
mov ah, 09h
mov dx, offset titre3
int 21h
jmp affprenom
;invitation à rentrer son prénom
invprenom:
mov ah, 09h
mov dx, offset prenom
int 21h
;encodage du prenom
mov ah, 3Fh
mov bx, 0
mov cx, 100
mov dx, offset dataread
int 21h
cmp ax, 2
jle sortie
push ax
; invitation à entrer son nom
invnom:
mov ah, 09h
mov dx, offset nom
int 21h
;encodage du nom
mov ah, 3Fh
mov bx, 0
mov cx, 100
mov dx, offset dataread1
int 21h
cmp ax, 2
jle sortie
push ax
affprenom:
mov ah, 40h
mov bx, 1
pop cx
mov dx, offset dataread
int 21h
affnom:
mov ah, 40h
mov bx, 1
pop cx
mov dx, offset dataread1
int 21h
;fin du programme
sortie:
mov ah, 4Ch
mov al,0
int 21h
;retourner au DOS
main ENDP
END main