【求助】/*把输入的6个不等长字符串按长度顺序输出*/不知道选择排序部分哪里出了问题。。

[复制链接]
查看11 | 回复3 | 2021-1-27 05:48:41 | 显示全部楼层 |阅读模式
/*输入6个不等长字符串,将这6个字符串按照字符串长度排序,
并按从长到短的顺序输出字符串。*/
#include
#include
usingnamespacestd;
intmain()
{
charstr[6][45];
charc[45];
inti,j,x,max;
for(i=0;i>str;
coutstrlen(str))
max=j;
strcpy(c,str[max]);
strcpy(str[max],str);
strcpy(str,c);
}
cout -->
回复

使用道具 举报

千问 | 2021-1-27 05:48:41 | 显示全部楼层
写的有问题,思路不太对
回复

使用道具 举报

千问 | 2021-1-27 05:48:41 | 显示全部楼层
没看到虾米问题,有问题截图来看。
回复

使用道具 举报

千问 | 2021-1-27 05:48:41 | 显示全部楼层
intmain()
{
charstr[6][45];
charc[45];
inti,j,max;
for(i=0;i>str;
coutstrlen(str))
{
max=j;
strcpy(c,str[max]);
strcpy(str[max],str);
strcpy(str,c);
}
}
}
cout
#include
#include
usingnamespacestd;
intmain()
{
charstr[6][45];
charc[45];
inti,j,x,max;
for(i=0;i>str;
coutstrlen(c))
{
max=j;
strcpy(c,str[max]);
}
}
if(i!=max){
strcpy(str[max],str);
strcpy(str,c);
}
}
cout
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行