Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void ext_bef(char* input, char* output) //prende solo char prima degli spazi
- {
- while (*input != ' ') {
- *output = *input;
- input++;
- output++;
- }
- *output = '\0';
- }
- void ext_late(char* input, char* output) //prende solo char dopo gli spazi
- {
- while (*input != ' ') input++; //passa i char prima dello spazio
- while (*input == ' ') input++; //passa gli spazi
- while (*input)
- {
- *output = *input;
- input++;
- output++;
- }
- *output = '\0';
- }
- int main()
- {
- char inputline[100];
- cin.getline(inputline,100);
- char bef_space[100];
- ext_bef(inputline, bef_space);
- char *p_bef_space = bef_space;
- char late_space[100];
- ext_late(inputline, late_space);
- char *p_late_space = &late_space[0];
- cout << p_late_space << endl << p_bef_space;
- }
Add Comment
Please, Sign In to add comment