Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
155502 邓弘锐 19选班长II C++ Compile Error 0 MS 0 KB 486 2026-06-07 14:07:13

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main() { int a=0,b=0,c=0; while(1){ cin>>x; if(x==-1) break; if(x==1) a++; else if(x==2) b++; else if(x==3) c++; tot++; } cout<<"A="<<a<<endl; cout<<"B="<<b<<endl; cout<<"C="<<c<<endl; cout<<"Tot="<<tot<<endl; if(a>tot/2){ cout<<"A-yes"<<endl; } else if(b>tot/2){ cout<<"B-yes"<<endl; } else if(c>tot/2){ cout<<"C-yes"<<endl; } else{ cout<<"all-NO"<<endl; } return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:6:8: error: 'x' was not declared in this scope
   cin>>x;
        ^
Main.cc:11:3: error: 'tot' was not declared in this scope
   tot++;
   ^
Main.cc:16:16: error: 'tot' was not declared in this scope
  cout<<"Tot="<