daily pastebin goal
51%
SHARE
TWEET

Untitled

a guest Jan 23rd, 2019 129 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. char sir[100]="  Am plecat la examen sssddd sssser ";
  6.  
  7. int countCuvinte(char *sir)
  8. {
  9.     _asm
  10.     {
  11.         mov edi, [ebp + 8]; //sirul
  12.         mov esi, 1; //contor
  13.         mov eax, 0; //numar spatii
  14.     _while:
  15.         movzx ebx, byte ptr[edi + esi];
  16.         movzx ecx, byte ptr[edi + esi - 1];
  17.         movzx edx, byte ptr[edi + esi + 1];
  18.         cmp ebx, 0;
  19.         je _iesire; //null
  20.         cmp ebx, 32;
  21.         je _verif;
  22.         inc esi;
  23.         jmp _while;
  24.     _verif:
  25.         cmp ecx, 32;
  26.         jne _verif2;
  27.         inc esi;
  28.         jmp _while;
  29.     _verif2:
  30.         cmp edx, 32;
  31.         jne _verif3;
  32.         inc esi;
  33.         jmp _while;
  34.     _verif3:
  35.         cmp edx, 0;
  36.         jne _verif4;
  37.         inc esi;
  38.         jmp _while;
  39.     _verif4:
  40.         inc eax;
  41.         inc esi;
  42.         jmp _while;
  43.     _iesire:
  44.         inc eax;
  45.     }
  46. }
  47.  
  48. int main()
  49. {
  50.     int rezultat;
  51.     _asm
  52.     {
  53.         lea eax, sir;
  54.         push eax;
  55.         call countCuvinte;
  56.         mov rezultat, eax;
  57.         add esp, 4;
  58.     }
  59.     cout << rezultat << "\n";
  60.     system("Pause");
  61.     return 0;
  62. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top