candrei98

Untitled

Mar 10th, 2019
778
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <iostream>
  4.  
  5. int main()
  6. {
  7. char str[200];
  8.  
  9. printf("Introduceti sirul de charactere: ");
  10.  
  11. std::cin.getline(str, 200);
  12.  
  13. int l = strlen(str);
  14.  
  15. for (int i = l - 1; i >= 0; i--) {
  16. if (str[i] == ' ') {
  17.  
  18. str[i] = '\0';
  19.  
  20. printf("%s", &(str[i]) + 1);
  21. }
  22. }
  23.  
  24. printf("%s", str);
  25.  
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment