View Code of Problem 81

#include <iostream>
#include <cstdio>
using namespace std;
struct Stu{
    int y,m,d;
}stu;
int main(){
    cin>>stu.y>>stu.m>>stu.d;
    int a[12]={31,28,31,30,31,30,31,31,30,31,30,31},day=0;
    for(int i=0;i<stu.m-1;i++){
        day+=a[i];
    }
    if((stu.y%4==0&&stu.y%100!=0)||(stu.y%400==0))
        cout<<day+stu.d+1<<endl;
    else
        cout<<day+stu.d<<endl;
    return 0;
}


Double click to view unformatted code.


Back to problem 81