Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
62678 许铭锐 字符串相等判断 C++ Compile Error 0 MS 0 KB 321 2023-12-24 17:37:34

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ char a[1001],b[1001]; cin>>a>>b; int c=strlen(a),d=strlen(b); if(c!=d){ cout<<"no"; }else{ int sum=0; for(int i=0;i<c;i++){ if(a[i]==b[i]){ sum++; } } } if(sum==c){ cout<<"yes"; }else{ cout<<"no"; } return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:18:5: error: 'sum' was not declared in this scope
  if(sum==c){
     ^