Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
157608 汪明轩 字符串相等判断 C++ Compile Error 0 MS 0 KB 353 2026-08-08 09:13:30

Tests(0/0):


Code:

#include<iostream> #include<cstring> using namespace std; int main(){ char a[1002],b[1002]; cin>>a>>b; int s1=strlen(a); int s2=strlen(b); if(s1!=s2){ cout<<"no"; break; } else{ for(int i=1;i<=s1;i++){ if(a[i]==b[i]){ cout<<"yes"; break; } else{ cout<<"no"; break; } } } return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:11:3: error: break statement not within loop or switch
   break;
   ^