65,204
社区成员
发帖
与我相关
我的任务
分享
const string & findmax ( const vector<string> & arr )
{
int maxindex = 0;
for ( int i=1; i<arr.size(); i++)
if ( arr [maxindex] < arr[i])
maxindex = i;
return arr[ maxindex ];
}
const string & findmaxwrong( const vector<string> & arr)
{
string maxvalue = arr[0];
for ( int i=1; i<arr.size(); i++)
if (maxvalue < arr[i])
maxvalue = arr[i];
return maxvalue;
}