Guest User

Untitled

a guest
Apr 26th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.77 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void ext_bef(char* input, char* output) //prende solo char prima degli spazi
  5. {
  6. while (*input != ' ') {
  7. *output = *input;
  8. input++;
  9. output++;
  10. }
  11. *output = '\0';
  12. }
  13.  
  14. void ext_late(char* input, char* output) //prende solo char dopo gli spazi
  15. {
  16. while (*input != ' ') input++; //passa i char prima dello spazio
  17. while (*input == ' ') input++; //passa gli spazi
  18. while (*input)
  19. {
  20. *output = *input;
  21. input++;
  22. output++;
  23. }
  24. *output = '\0';
  25. }
  26.  
  27. int main()
  28. {
  29. char inputline[100];
  30. cin.getline(inputline,100);
  31. char bef_space[100];
  32. ext_bef(inputline, bef_space);
  33. char *p_bef_space = bef_space;
  34. char late_space[100];
  35. ext_late(inputline, late_space);
  36. char *p_late_space = &late_space[0];
  37. cout << p_late_space << endl << p_bef_space;
  38. }
Add Comment
Please, Sign In to add comment