Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
121675 王子涵 18统计成绩 C++ Compile Error 0 MS 0 KB 331 2025-06-08 08:40:47

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ int n,maxn=0,minn=101,a[101],sum=0,pj; double pj cin>>n; for(int i=0;i<=n;i++) { cin>>a[i]; sum+=a[i] if(a[i]>maxn) maxn=a[i]; if(a[i]<minn) minn=a[i]; } pj=float(sum)/n; printf("%.2f",pj) cout<<" "<<maxn<<" "<<minn; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:6:2: error: expected initializer before 'cin'
  cin>>n;
  ^
Main.cc:11:3: error: expected ';' before 'if'
   if(a[i]>maxn)
   ^
Main.cc:17:18: warning: format '%f' expects argument of type 'double', but argument 2 has type 'int' [-Wformat=]
  printf("%.2f",pj)
                  ^
Main.cc:18:2: error: expected ';' before 'cout'
  cout<<" "<