Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
62732 段文昊 如何得到"hello" C++ Compile Error 0 MS 0 KB 307 2023-12-27 23:27:19

Tests(0/0):


Code:

#include <iostream> using namespace std; int main() { char b[5]={"h,a,l,l,o"}; char a[1501]; int sum=0; cin>>a; int n=strlen(a); for(int i=0;i<a;i++){ if(a[i]!=b[i]){ a[i]=0; } else{ sum++; } } if(sum==5){ cout<<"yes"; } else{ cout<<"no"; } return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:4:24: error: initializer-string for array of chars is too long [-fpermissive]
  char b[5]={"h,a,l,l,o"};
                        ^
Main.cc:8:16: error: 'strlen' was not declared in this scope
  int n=strlen(a);
                ^
Main.cc:9:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  for(int i=0;i