Advertisement
Guest User

Untitled

a guest
Jan 20th, 2018
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <string.h>
  3.  
  4. using namespace std;
  5.  
  6. char * usunspacje(char * tekst)
  7. {
  8. int pozycja;
  9. if( tekst[0]=='\0' )
  10. return tekst;
  11.  
  12. while( tekst[pozycja]!='\0' )
  13. {
  14. if( tekst[pozycja]==' ')
  15. strcpy( &tekst[pozycja], &tekst[pozycja+1]);
  16. else pozycja ++;
  17. }
  18. return tekst;
  19. }
  20.  
  21. int main()
  22. {
  23. char tekst[100];
  24. cout << "Podaj zdanie: " << endl;
  25. cin >> tekst;
  26.  
  27. usunspacje(tekst);
  28.  
  29. cout << tekst;
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement