⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 f0808.cpp

📁 it is a usefull thing
💻 CPP
字号:
//=====================================
// f0808.cpp
// bad design: public data members
//=====================================
#include<iostream>
#include<iomanip>
using namespace std;
//-------------------------------------
class Date{
public:
  int year, month, day;
};//-----------------------------------
void print(Date);
bool isLeapYear(Date d);
//-------------------------------------
int main(){
  Date d;
  d.year = 2000;
  d.month = 12;
  d.day = 6;
  if(isLeapYear(d))
    print(d);
}//------------------------------------
void print(Date s){
  cout<<setfill('0');
  cout<<setw(4)<<s.year<<'-'<<setw(2)<<s.month<<'-'<<setw(2)<<s.day<<'\n';
  cout<<setfill(' ');
}//------------------------------------
bool isLeapYear(Date d){
  return (d.year % 4==0 && d.year % 100!=0)||(d.year % 400==0);
}//====================================

 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -