Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
78861 邓嘉瑶 如何得到"hello" C++ Compile Error 0 MS 0 KB 459 2024-06-29 11:45:44

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int sum,sum1,sum2; int main(){ char a[1500]; scanf("%s",a); int len=strlen(a); for(int i=0;i<len;i++){ if(a[i]=='h'){ sum++; }else if(a[i]=='e'){ sum1++; }else if(a[i]=='l'){ sum2++; }else if(a[i]=='l'){ sum2++; }else if(a[i]=='o'){ sum3++; } } if(sum>=1&&sum1>=1&&sum2>=2&&sum3>=1){ cout<<"YES"; }else{ cout<<"NO"; } return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:19:7: error: 'sum3' was not declared in this scope
       sum3++;
       ^
Main.cc:22:31: error: 'sum3' was not declared in this scope
  if(sum>=1&&sum1>=1&&sum2>=2&&sum3>=1){
                               ^
Main.cc:7:15: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%s",a);
               ^