Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2020
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. void printWords(char str[]) {
  7. char word[128];
  8.  
  9. for (unsigned int i = 0, ind=0; i <= strlen(str); i++) {
  10. word[ind] = str[i];
  11.  
  12. if (str[i] == ' ' || str[i] == '\0') {
  13. word[ind] = NULL;
  14. cout << word << "\n";
  15.  
  16. ind = 0;
  17. }
  18. else ind++;
  19. }
  20. }
  21.  
  22. void sort(char str[], int n) {
  23.  
  24. }
  25.  
  26. int main() {
  27. char s[128];
  28. int words = 0;
  29. scanf("%256[^\n]%*c", s);
  30.  
  31. printWords(s);
  32. return 1;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement