Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
6199 柯宇希 字符串长度判断 C++ Compile Error 0 MS 0 KB 500 2025-01-13 15:39:52

Tests(0/0):


Code:

#include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ char s1[151],s2[151]; cin>>s1>>s2; int s1_num=0,s2_num=0; int i=0 while(s1[i]!='\0'){ s1_num++; i++; } while(s2[i]!='\0'){ s2_num++; i++; } if(s1_num==s2_num){ cout<<"yes"<<endl; } else cout<<"no"<<endl; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:8:5: error: 'cin' was not declared in this scope
     cin>>s1>>s2;
     ^
Main.cc:11:5: error: expected ',' or ';' before 'while'
     while(s1[i]!='\0'){
     ^
Main.cc:20:9: error: 'cout' was not declared in this scope
         cout<"yes"<<endl;
         ^
Main.cc:20:22: error: 'endl' was not declared in this scope
         cout<<"yes"<<endl;
                      ^
Main.cc:22:10: error: 'cout' was not declared in this scope
     else cout<<"no"<<endl;
          ^
Main.cc:22:22: error: 'endl' was not declared in this scope
     else cout<<"no"<<endl;
                      ^