Facebook
From Mateuszek, 5 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 231
  1. #include <iostream>
  2. #include <stdio.h>
  3. #include <string.h>
  4. int main()
  5. {
  6. char tekst[100], nowytekst[100];
  7. int i = 0, j = 0, count = 0;
  8.  
  9. printf("Wpisz tekst:\n");
  10.  
  11.            for(i = 0; (tekst[i]=getchar())!='\n'; i++)
  12. {
  13. }        
  14. tekst[i] = '\0';
  15.  
  16. count = i;
  17.  
  18.  
  19. for(i = 0; i<count; i++)
  20. {
  21.            nowytekst[j] = tekst[i];
  22. j++;
  23.  
  24. nowytekst[j] = ' ';
  25. j++;
  26. }
  27. nowytekst[j] = '\0';
  28.  
  29. printf("Tekst normalny: %s \n",tekst);
  30. printf("Tekst ze spacjami: %s \n",nowytekst);                
  31. }