Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void Trim(char ch[101]);
- int main()
- {
- char ch[101];
- cin.get(ch, 101);
- Trim(ch);
- for (int i = 0; ch[i]; ++i)
- cout << ch[i];
- }
- void Trim(char ch[101])
- {
- int poz1 = 0;
- while (ch[poz1] == ' ')
- poz1++;
- int poz2 = 0;
- while (ch[poz2])
- poz2++;
- poz2--;
- while (ch[poz2] == ' ')
- poz2--;
- char t[101] = "";
- char v[101] = "";
- ch[101] = v[101];
- int x = poz2 - poz1;
- for (int i = 0; i <= x; ++i)
- t[i] = ch[poz1 + i];
- for (int i = 0; i <= x; ++i)
- ch[i] = t[i];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement