You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
553 B
C++
25 lines
553 B
C++
A filter to remove white-space characters at the ends of lines.
|
|
#include <iostream>
|
|
#include <string>
|
|
using namespace std;
|
|
void cutline( void );
|
|
string line;
|
|
int main()
|
|
{
|
|
while( getline(cin, line)) {
|
|
cutline();
|
|
cout << line << endl;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
void cutline()
|
|
{
|
|
int i = line.size();
|
|
|
|
while( i-- >= 0 )
|
|
if( line[i] != ' ' && line[i] != '\t' )
|
|
break;
|
|
line.resize(++i);
|
|
}
|