<span style="font-size:18px;">#include <iostream>
#include <string>
using namespace std;
int main()
{
int i,j;
string temp;
string str[5]={ "chen","sheng","is","very","cool"};
for(i=0;i<5;i++)
{
for(j=i;j<5;j++)
{
if(str[i]<str[j])
{
temp=str[i];
str[i]=str[j];
str[j]=temp;
}
}
}
for(i=0;i<5;i++)
{
cout<<str[i]<<" ";
}
cout<<endl;
return 0;
}</span>
第十二题 P035
最新推荐文章于 2021-02-27 13:33:32 发布