Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
102435 罗迎甲 19选班长II C++ Compile Error 0 MS 0 KB 643 2024-12-21 16:13:10

Tests(0/0):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() int a[1000]={},n,t,j,i,tot,max=0; for(i=1;;i++){ cin >>t; if(t==-1){ break; } j++; a[t]++; } cout << "A="<<a[1]<<endl; cout << "B="<<a[2]<<endl; cout << "C="<<a[3]<<endl; cout << "Tot="<<j<<endl; if(a[1]>j/2) cout <<"A-yes"<<endl; else if(a[2]>j/2) cout << "B-yes"<<endl; else if (a[3]>j/2){ cout << "C-yes"<<endl; } else{ cout << "all-NO"<<endl; return 0; }


Run Info:

Main.cc:7:1: error: expected unqualified-id before 'for'
 for(i=1;;i++){ 
 ^
Main.cc:7:10: error: 'i' does not name a type
 for(i=1;;i++){ 
          ^
Main.cc:15:2: error: 'cout' does not name a type
  cout << "A="<j/2) 
 ^
Main.cc:21:1: error: expected unqualified-id before 'else'
 else if(a[2]>j/2) 
 ^
Main.cc:23:1: error: expected unqualified-id before 'else'
 else if (a[3]>j/2){ 
 ^
Main.cc:26:1: error: expected unqualified-id before 'else'
 else{ 
 ^