1 #include <iostream> 2 3 using namespace std; 4 5 class Date 6 { 7 private: 8 int year; 9 int month; 10 int day; 11 public: 12 Date(){year=1900;month=1;day=1;} 13 Date(int,int,int); 14 void Show(); 15 void Init(int,int,int); 16 }; 17 18 Date::Date(int a, int b, int c) 19 { 20 year=a; 21 month=b; 22 day=c; 23 } 24 25 void Date::Show() 26 { 27 cout<<year<<'-'<<month<<'-'<<day<<endl; 28 return; 29 } 30 31 void Date::Init(int a, int b, int c) 32 { 33 year=a; 34 month=b; 35 day=c; 36 return; 37 } 38 39 int main() 40 { 41 Date d1,d2(2100,12,12); 42 int a,b,c; 43 cin>>a>>b>>c; 44 d1.Show(); 45 d2.Show(); 46 d1.Init(a,b,c); 47 d1.Show(); 48 return 0; 49 }