date.cpp

来自「压缩包里有教材<<C++模式设计-基于QT4开源跨平台开发框架&gt」· C++ 代码 · 共 26 行

CPP
26
字号
#include <QDate>#include "date.h"#include <iostream>Date::Date(int d , int m , int y ) : m_Day(d), m_Month(m), m_Year(y) {        static QDate currentDate = QDate::currentDate(); /* We use        Qt's QDate class only to get the current date. */        if (m_Day == 0) m_Day = currentDate.day();     if (m_Month == 0) m_Month = currentDate.month();    if (m_Year == 0) m_Year = currentDate.year();}        void Date::display(bool eoln) const {    using namespace std;    cout << m_Year << "/" << m_Month << '/' << m_Day;    if (eoln)        cout << endl;}

⌨️ 快捷键说明

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