题解 | #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")

全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务