Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- int main()
- {
- char s[201] = "in vacanta plec la mare";
- //cin.get(s,101);
- cout << "S este: " << s << "\n\n";
- for(int i = 0; i < strlen(s); i++)
- {
- if(s[i] == ' ' && s[i+1] == ' ')
- {
- //strcpy(s+i, s+i+1);
- char aux[201];
- strcpy(aux, s+i+1);
- strcpy(s+i, aux);
- cout << "[DEBUG]: " << s << "\n";
- cout << "[DEBUG]: " << i << "\n\n";
- i = i - 1;
- }
- }
- cout << s;
- cout << "\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement