Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
72691 罗子童 08有几个闰年 C++ Compile Error 0 MS 0 KB 284 2024-05-12 15:10:56

Tests(0/0):


Code:

# include<iostream> using namespace std; int main(){ int a,b,c,g; int g=0; cin>>a>>b>>c; if(a%4==0&&a%100!=0||a%400==0){ g+=1; } if(b%4==0&&b%100!=0||b%400==0){ g+=1; } if(c%4==0&&c%100!=0||c%400==0){ g+=1; } cout<<g; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:5:5: error: redeclaration of 'int g'
 int g=0;
     ^
Main.cc:4:11: note: 'int g' previously declared here
 int a,b,c,g;
           ^
Main.cc:8:10: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
 if(a%4==0&&a%100!=0||a%400==0){
          ^
Main.cc:11:10: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
 if(b%4==0&&b%100!=0||b%400==0){
          ^
Main.cc:14:13: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
    if(c%4==0&&c%100!=0||c%400==0){
             ^