?? io20_2_1.01.c
字號:
#include <iostream.h>
#include <string.h>
/**
**
The number of words read is 65
The longest word has a length of 10
The longest word is creature,"
**
**/
int main()
{
const int bufSize = 24;
char buf[ bufSize ], largest[ bufSize ];
// hold statistics;
int curLen, max = -1, cnt = 0;
while ( cin >> buf )
{
curLen = strlen( buf );
++cnt;
// new longest word? save it.
if ( curLen > max ) {
max = curLen;
strcpy( largest, buf );
}
}
cout << "The number of words read is "
<< cnt << endl;
cout << "The longest word has a length of "
<< max << endl;
cout << "The longest word is "
<< largest << endl;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -