Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- char sir[100]=" Am plecat la examen sssddd sssser ";
- int countCuvinte(char *sir)
- {
- _asm
- {
- mov edi, [ebp + 8]; //sirul
- mov esi, 1; //contor
- mov eax, 0; //numar spatii
- _while:
- movzx ebx, byte ptr[edi + esi];
- movzx ecx, byte ptr[edi + esi - 1];
- movzx edx, byte ptr[edi + esi + 1];
- cmp ebx, 0;
- je _iesire; //null
- cmp ebx, 32;
- je _verif;
- inc esi;
- jmp _while;
- _verif:
- cmp ecx, 32;
- jne _verif2;
- inc esi;
- jmp _while;
- _verif2:
- cmp edx, 32;
- jne _verif3;
- inc esi;
- jmp _while;
- _verif3:
- cmp edx, 0;
- jne _verif4;
- inc esi;
- jmp _while;
- _verif4:
- inc eax;
- inc esi;
- jmp _while;
- _iesire:
- inc eax;
- }
- }
- int main()
- {
- int rezultat;
- _asm
- {
- lea eax, sir;
- push eax;
- call countCuvinte;
- mov rezultat, eax;
- add esp, 4;
- }
- cout << rezultat << "\n";
- system("Pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement