当前位置:网站首页>Pta:7-64 what day of the year is this day
Pta:7-64 what day of the year is this day
2022-06-23 04:38:00 【Sy_ Faker】
Define a date class Date, Member years with data 、 month 、 Japan , There are other member functions : Constructor is used to initialize data members , Output , Leap year judgment . Write the main function : Create date object , Calculate and output the day which is the day of the year . Input format : The test input contains several test cases , One line per test case . When read in 0 0 0 When the input is over , Do not output the corresponding result .
sample input :
2006 3 5
2000 3 5
0 0 0
sample output :( In parentheses is the description )
64 (2006 year 3 month 5 Day is the... Of the year 64 God )
65 (2000 year 3 month 5 Day is the... Of the year 65 God )
#include<iostream>
using namespace std;
int A[12]={
31,29,31,30,31,30,31,31,30,31,30,31};
int B[12]={
31,28,31,30,31,30,31,31,30,31,30,31};
class Date
{
int year;
int month;
int day;
public:
Date(int y,int m,int d):year(y),month(m),day(d){
;}
void show()
{
if((year%4==0&&year%100!=0)||year%400==0)
{
for(int i=0;i<month-1;i++)
{
day+=A[i];
}
}
else
{
for(int i=0;i<month-1;i++)
{
day+=B[i];
}
}
cout<<day<<endl;
}
};
int main()
{
int a,b,c;
cin>>a>>b>>c;
while(a!=0&&b!=0&&c!=0)
{
Date d(a,b,c);
d.show();
cin>>a>>b>>c;
}
}
边栏推荐
猜你喜欢

8 key indicators to measure technology debt in 2022

If you want to understand PostgreSQL, you must first brush the architecture

众昂矿业:新能源新材料产业链对萤石需求大增

What is metadata

8位全加器原理

【一起上水硕系列】Day Three - preview4

Particle animation background login page particles js

Black horse PostgreSQL, why is it black in the end

Analysis on the current situation of the Internet of things in 2022

【深度学习】深度学习推理框架 TensorRT MNN OpenVINO ONNXRuntime
随机推荐
JD cloud distributed database stardb won the "stability practice pioneer" of China Academy of information technology
PTA:7-65 饮料的价格
Audio and video development journey (63) - animation and rendering of Lottie source code analysis
Getting started with tensorflow
基于FPGA的VGA协议实现
Pta:6-33 student ranking table (destructor)
IDEA-导入模块
3D数学基础[十六] 匀加速直线运动的公式
How does flutter achieve different zoom animation effects
PTA:6-33 学生排名表(析构函数)
Pta:6-30 time addition
There is a problem with redis startup
svg d3. JS generate tree tree view
P1363 phantom maze (DFS)
Basic skills of x64dbg
[binary tree] flip equivalent binary tree
深度学习 简介
Fundamentals of 3D mathematics [16] formulas for uniformly accelerated linear motion
PTA:7-64 该日是该年的第几天
Tables de recherche statiques et tables de recherche statiques