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

📄 date.cpp

📁 This file set two employees information and print them out and tell today is whose borthday.
💻 CPP
字号:
//*********************************************************
// IMPLEMENTATION FILE (Date.cpp)  
// This file implements the Date class member functions
// Date representation: int variable -- year,mon and day
//*********************************************************
#include "Date.h"
#include <iostream>

using namespace std;

// Private members of class:
//    int  year,mon,day;    
//*********************************************************

Date::Date( /* in */ int initYear,
            /* in */ int initMon,
            /* in */ int initDay )
// Constructor
// Precondition:
//     0 <= initYear  &&  1 <= initMon <= 12
//  && 1 <= initDay <= 31
// Postcondition:
//     year == initYear  &&  mon == initMon  &&  day == initDay
{
    year = initYear;
    mon = initMon;
    day = initDay;
}
//******************************************************************
Date::Date()
// Default constructor
// Postcondition:
//     year == 0  &&  mon == 0  &&  day == 0
{
    year = 0;
    mon = 0;
    day = 0;
}
//******************************************************************
void Date::SetDate(/*in*/int y,   // set year
		           /*in*/ int m,  // set month
				   /*in*/ int d) // set day
// Precondition:
//     1 <= m <= 12
//  && 1 <= d <= maximum no. of days in month newMonth
//  && y > 1582
// Postcondition:
//     mo == newMonth  &&  day == newDay  &&  yr == newYear
{
    year = y;
    mon = m;
    day = d;
}
//******************************************************************
void Date::GetDate() 
{
    cout << year << "年" << mon << "月" << day << "日" << endl;
}
//******************************************************************
int Date::GetYear() 
{
    return year;
}
//******************************************************************
int Date::GetMonth() 
{
    return mon;
}
//******************************************************************
int Date::GetDay() 
{
    return day;
}
//******************************************************************

⌨️ 快捷键说明

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