Advertisement
Tranvick

Пробелы

Jun 18th, 2013
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.80 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     char s[100];
  7.     int n;
  8.     cin.getline(s, 100);
  9.     _asm {
  10.         lea esi, s
  11.         xor eax, eax
  12.         xor ecx, ecx
  13. _loop1:
  14.         cmp byte ptr [esi], 0
  15.         je _endl1
  16.         cmp byte ptr [esi], ' '
  17.         jne _noteq
  18.         mov eax, esi
  19. _noteq:
  20.         cmp eax, 0
  21.         jne _noteq1
  22.         mov edi, esi
  23. _noteq1:
  24.         inc ecx
  25.         inc esi
  26.         jmp _loop1
  27. _endl1:
  28.        
  29.  
  30.         mov ebx, eax
  31.         sub ebx, edi
  32.         push ebx
  33.  
  34.         lea ebx, s
  35.         add ebx, ecx
  36.         sub ebx, eax
  37.         dec ebx
  38.  
  39.         inc eax
  40.         add edi, 2
  41. _loop2:
  42.         mov dl, byte ptr [eax]
  43.         mov byte ptr [edi], dl
  44.         inc eax
  45.         inc edi
  46.         dec ebx
  47.         cmp ebx, 0
  48.         jg _loop2
  49.  
  50.         pop ebx
  51.         dec ebx
  52.         sub eax, ebx
  53.         cmp ebx, 0
  54.         jng _end
  55. _loop3:
  56.         mov byte ptr [eax], ' '
  57.         inc eax
  58.         dec ebx
  59.         cmp ebx, 0
  60.         jg _loop3
  61. _end:
  62.     }
  63.     cout << s;
  64.     return 0;
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement