Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string.h>
- using namespace std;
- int main() {
- char s[21];
- char result[21];
- char nume[11];
- char prenume[11];
- // Popescu Vasile
- cin.getline(s, 21);
- char* pch = strtok(s, " "); // pch contine Popescu
- strcpy(nume, pch); // nume continer popescu
- pch = strtok(NULL, " "); // pch contine Vasile
- strcpy(prenume, pch);
- strcpy(result, prenume);
- strcat(result, " ");
- strcat(result, nume);
- cout << result;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment