题解 | #KiKi定义电子日历类#
KiKi定义电子日历类
https://www.nowcoder.com/practice/e4c67097cdb242d9a3f38b7cfe839396
#include <iostream> #include <ostream> using namespace std; class TDate { private: int Month; int Day; int Year; public: TDate(): Month(0), Day(0), Year(0) {} void printDate() { cout << Day << "/" << Month << "/" << Year; } void setDate() { cin >> Year >> Month >> Day; } }; int main() { TDate date; date.setDate(); date.printDate(); return 0; } // 64 位输出请用 printf("%lld")