Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main(){
- char chaine[]={"aeiou"};
- // char chaine[]={'a','e','i','o','u','e'};
- unsigned char num_voyalles(0);
- asm(
- "xor %[num],%[num] \n\t"
- "lea %[chaine],%%rcx \n\t" /* cible une chaine de chars */
- "\n init :\n\t"
- "cmpb $0,(%%rcx) \n\t"/*il est arrive à la fin ?*/
- "jz fin \n\t"
- "cmpb $'a',(%%rcx) \n\t"/* a */
- "jz augmenter \n\t"
- "cmpb $'e',(%%rcx) \n\t"/* e */
- "jz augmenter \n\t"
- "cmpb $'i',(%%rcx) \n\t"/* i */
- "jz augmenter \n\t"
- "cmpb $'o',(%%rcx) \n\t"/* o */
- "jz augmenter \n\t"
- "cmpb $'u',(%%rcx) \n\t"/* u */
- "jz augmenter \n\t"
- "inc %%rcx \n\t"/* incremente l'index de la chaine */
- "jmp init \n\t"/* saute au debut */
- "\n augmenter: \n\t"/* aeiou trouve incremente num */
- "inc %[num] \n\t"
- "inc %%rcx \n\t"/* incremente l'index de la chaine */
- "jmp init \n\t "/* saute au debut */
- "fin: \n\t"
- :[num] "=g"(num_voyalles) /* output */
- :[chaine]"m"(chaine) /* input */
- :
- );
- cout <<"num de voyalles "<<(int) num_voyalles <<endl;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement