| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 134438 | whs | 04保留两位小数 | C++ | Compile Error | 0 MS | 0 KB | 161 | 2025-10-27 17:01:19 |
#include <iostream> using namespace std; int main(){ int a,b,c,d; double a=5.0; double b=2.5; printf("%.2lf",a); printf("%.2lf",b); }
Main.cc: In function 'int main()':
Main.cc:5:12: error: conflicting declaration 'double a'
double a=5.0;
^
Main.cc:4:7: note: previous declaration as 'int a'
int a,b,c,d;
^
Main.cc:6:12: error: conflicting declaration 'double b'
double b=2.5;
^
Main.cc:4:9: note: previous declaration as 'int b'
int a,b,c,d;
^
Main.cc:7:19: warning: format '%lf' expects argument of type 'double', but argument 2 has type 'int' [-Wformat=]
printf("%.2lf",a);
^
Main.cc:8:21: warning: format '%lf' expects argument of type 'double', but argument 2 has type 'int' [-Wformat=]
printf("%.2lf",b);
^
Main.cc:4:11: warning: unused variable 'c' [-Wunused-variable]
int a,b,c,d;
^
Main.cc:4:13: warning: unused variable 'd' [-Wunused-variable]
int a,b,c,d;
^