Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
62443 刘宇轩 如何得到"hello" C++ Compile Error 0 MS 0 KB 493 2023-12-23 17:37:15

Tests(0/0):


Code:

#include<iostream> # include<cstring> using namespace std; int main(){ char a[1500],b[1500],d[5]; cin>>a; int c=strlen(a); int n; for(int i=0;i<c;i++){ if(a[i]=='h'){ d[1]='h'; } if(a[i]=='e'){ d[2]='e'; } if(a[i]=='l'){ d[3]='l'; } if(a[i]=='l'){ d[4]='l'; } if(a[i]=='o'){ d[5]='o'; } } if(d[1]=='h'&&d[2]=='e'&&d[3]=='l'&&d[4]=='l'&&d[5]=='o'&&){ cout<<"YES"; } else{ cout<<"NO"; } return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:26:60: error: expected primary-expression before ')' token
  if(d[1]=='h'&&d[2]=='e'&&d[3]=='l'&&d[4]=='l'&&d[5]=='o'&&){
                                                            ^
Main.cc:5:15: warning: unused variable 'b' [-Wunused-variable]
  char a[1500],b[1500],d[5];
               ^
Main.cc:8:6: warning: unused variable 'n' [-Wunused-variable]
  int n;
      ^