麻烦帮我看下这个程序有啥问题,刚学c++不怎么会,谢谢
#include<iostream>using namespace std;
int main(){
char s1[20],s2[20];
puts(s1);
puts(s2);
int r,i;
for(i=0;s1[i]!='\0'&&s2[i]!='\0';i++){
if (s1[i]>s2[i]){
return r=1;
cout<<"r= "<<r<<endl;
}
else if(s1[i]<s2[i]){
return r=-1;
cout<<"r= "<<r<<endl;
}
else
continue;
}
if(s1[i]=='\0'&&s2[i]=='\0'){
return r=0;
cout<<"r= "<<r<<endl;
}
else if(s1[i]!='\0'&&s2[i]=='\0'){
return r=1;
cout<<"r= "<<r<<endl;
}
else
return r=-1;
cout<<"r= "<<r<<endl;
return 0;
}