题解 | #KiKi定义电子日历类#
KiKi定义电子日历类
https://www.nowcoder.com/practice/e4c67097cdb242d9a3f38b7cfe839396
#include <iostream> using namespace std; class Calendar { public:Calendar() { Month =0; Day =0; Year =0; } void set_calendar(int a,int b, int c) { Year = a; Month = b; Day =c; } void get_calendar() { cout<<Day<<"/"<<Month<<"/"<<Year<<endl; } private: int Month; int Day; int Year; }; void test01() { Calendar a; int b =0; int c =0; int d =0; cin>>b>>c>>d; a.set_calendar(b,c,d); a.get_calendar(); } int main() { test01(); return 0; }