Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <string.h>
- using namespace std;
- void trimRight(char a[])
- {
- int length=strlen(a);
- for (int i=length-1;a[i]==' ';i--)
- {
- if (a[i-1]!=' ') a[i]=0;
- }
- }
- int main()
- {
- char str[30]="asdas dasda ";
- trimRight(str);
- strcat(str,"OK");
- cout<<str;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement