Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
164906 计算平均数 C++ Compile Error 0 MS 0 KB 302 2026-11-07 20:21:53

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ int a[5],f=0; double d; for(int i=1;i<=5;i++){ cin>>a[i]; f+=a; }d=f/5*1.00; printf("%.2d",d); cout<<endl; for(int i=1;i<=5;i++){ if(a[i]>d){ cout<<a[i]<<" "; } } }


Run Info:

Main.cc: In function 'int main()':
Main.cc:8:10: error: invalid use of non-lvalue array
         f+=a;
          ^
Main.cc:8:10: error:   in evaluation of 'operator+=(int, int [5])'
Main.cc:10:20: warning: format '%d' expects argument of type 'int', but argument 2 has type 'double' [-Wformat=]
     printf("%.2d",d);
                    ^