Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- char acFormatSaisie[] = "%f";
- char acFormatSaisie1[] = "%d";
- char acTxtSaisie[] = "\tEntrer le 1er nombre : ";
- char acTxtSaisie1[] = "\tEntrer le 2e nombre : ";
- char acTxtChoix[] = "\n\tQue voulez vous faire? \n\t1.Addition: \n\t2.Soustraction: \n\t3.Multiplication: \n\t4.Division: \n\t>";
- char acFormatAffichage[] = "\tVotre resultat vaut: %0.2f \n\tLe resultat arrondis est de: %d";
- float iVar, iVar1;
- int choix, resultatArrondis;
- double resultat;
- void main()
- {
- _asm
- {
- //Saisie du premier nombre
- push offset acTxtSaisie
- call dword ptr printf
- add esp, 4
- push offset iVar
- push offset acFormatSaisie
- call dword ptr scanf
- add esp, 8
- //Saisie du second nombre
- push offset acTxtSaisie1
- call dword ptr printf
- add esp, 4
- push offset iVar1
- push offset acFormatSaisie
- call dword ptr scanf
- add esp, 8
- //Affichage et saisie du choix
- push offset acTxtChoix
- call dword ptr printf
- add esp, 4
- push offset choix
- push offset acFormatSaisie1
- call dword ptr scanf
- add esp, 8
- movss xmm0, iVar
- movss xmm1, iVar1
- mov eax, choix
- //Switch
- cmp eax, 1
- je addition
- cmp eax, 2
- je soustraction
- cmp eax, 3
- je multiplication
- cmp eax, 4
- je division
- //Addition
- addition:
- addss xmm0, xmm1
- cvtss2sd xmm0, xmm0
- movsd resultat, xmm0
- cvtsd2si eax, xmm0
- mov resultatArrondis, eax
- push resultatArrondis
- push resultat+4
- push resultat
- jmp afficher
- //Soustraction
- soustraction:
- subss xmm0, xmm1
- cvtss2sd xmm0, xmm0
- movsd resultat, xmm0
- cvtsd2si eax, xmm0
- mov resultatArrondis, eax
- push resultatArrondis
- push resultat+4
- push resultat
- jmp afficher
- //multiplication
- multiplication:
- mulss xmm0, xmm1
- cvtss2sd xmm0, xmm0
- movsd resultat, xmm0
- cvtsd2si eax, xmm0
- mov resultatArrondis, eax
- push resultatArrondis
- push resultat+4
- push resultat
- jmp afficher
- //division
- division:
- divss xmm0, xmm1
- cvtss2sd xmm0, xmm0
- movsd resultat, xmm0
- cvtsd2si eax, xmm0
- mov resultatArrondis, eax
- push resultatArrondis
- push resultat+4
- push resultat
- jmp afficher
- //Affichage
- afficher:
- push offset acFormatAffichage
- call dword ptr printf
- add esp, 16
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement