Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
106415 顾梦琪 18高于平均分的学生数量 C++ Compile Error 0 MS 0 KB 575 2025-01-16 11:06:23

Tests(0/0):


Code:

using namespace std; int main() { //数组 int n; cin >> n; int a[n]; //1.数组的输入 for (int i = 0; i < n; i++) { cin >> a[i]; } //2.数组的总和:累加器 float s=0; for(int i=0;i<n;i++){ s=s+a[i]; } //3.求平均数 float w; w=s/n; //printf("%.2f\n",w); //4.输出大于平均数的数 for(int i=0;i<n;i++){ if(a[i]>w){ //cout<<a[i]<<" "; } }//cout<<endl; //5.小于平均数的数的个数 int b=0; for(int i=0;i<n;i++){ if(a[i]>w){ b++; } } cout<<b<<endl; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:5:2: error: 'cin' was not declared in this scope
  cin >> n;
  ^
Main.cc:33:2: error: 'cout' was not declared in this scope
  cout<