int cmp(stu x,stu y)
{
if(x.count==y.count)
{
int t3=strcmp(x.str,y.str);
if(t3>0)
return 0;
return 1;
}
return x.count>y.count;
}
中的int t3=strcmp(x.str,y.str);会报错为什么?
怎么解决?原因是什么?
关于strcmp()函数的问题
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
5条回答 默认 最新
threenewbee 2017-10-17 02:41关注你的str什么类型?string?直接用==就可以
用strcmp要先用c_str()得到其中的字符数组指针解决 无用评论 打赏 举报