C++.



              

- 3


/p>

}

:

$ a.out

The winter of our discontent

The

win

ter

of

our

dis

con

ten

t

setw()

, , .

:

while ( cin >> setw(sizeof( *pbuf )) >> pbuf )

setw() , pbuf.

*pbuf

, .. char. setw()

1. while , pbuf, . , .

string , string. :

#include <iostream.h>

#include <string>

int main()

{

string buf, largest;

//

int curLen, //

max = -1, //

cnt = 0; //

while ( cin >> buf )

{

curLen = buf.size();

++cnt;

// ?

if ( curLen > max )

{

max = curLen;

largest = buf;

}

}

cout << " " << cnt << endl;

cout << " " << max << endl;

cout << " " << largest << endl;

}

- . :

#include <string>

void filter_string( string &str )

{

// ,

string filt_elems( "\",?." );

string::size_type pos = 0;

while (( pos = str.find_first_of( filt_elems, pos ))

!= string::npos )

str.erase( pos, 1 );

<