程序代码:
#include <iostream>
#include <string>
using namespace std;
int main(void)
{
string src, des;
while (cin>>src)
{
cout << "长度:" << src.length() << endl;
if (src.length() >= des.length())
{
des = src;
}
}
cout << "最长字符串:" << des << endl;
return 0;
}
发个相同功能模块