Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
96303 吴诗涵 19选班长II C++ Compile Error 0 MS 0 KB 586 2024-11-03 19:10:15

Tests(0/0):


Code:

#include<iostream> using namespace std; int main(){ int n,e[100]={0},i=0,a=0,b=0,c=0; while(1){ cin>>e[i]; if(e[i]==-1){ break; } i++; } for(int h=0;h<=i;h++){ if(e[h]==1){ a++; } else if(e[h]==2){ b++; } else if(e[h]==3){ c++; } } cout<<"A="<<a<<endl<<"B="<<b<<endl<<"C="<<c<<endl<<"Tot="<<i<<endl; if(a>=i/2){ cout<<"A-yes"; } else if(b>=i/2){ cout<<"B-yes"; } else if(c>=i/2){ cout<<"C-yes"; } else{ cout<<"all-NO"; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:4:9: warning: unused variable 'n' [-Wunused-variable]
     int n,e[100]={0},i=0,a=0,b=0,c=0;
         ^
Main.cc:36:1: error: expected '}' at end of input
 }
 ^