0
0
已采纳
Hello!
这个代码有个错误:
1.字符数组不能直接用数组名比较:
if(a<b)
{
cout<<a;
}
if(b<a)
{
cout<<b;
}
是错误的
正确:
用string来定义字符串即可用字符串名来直接比较大小:
string a,b;
然后后面的不变
别忘了:
#include<string>
有啥问题评论里问
1
0
0
0
字符数组不能直接用数组名比较
只有字符串string类型才能这样。
string a,b,c;
cin>>a>>b;
if(a>b)
cout<<b<<endl;
if(a<=b)
cout<<a<<endl;
还有加头文件
#include<string>
你的代码中,没有a==b的情况
望采纳。。。。。。。
0