1 solutions
-
0
C++ :
#include <iostream> using namespace std; class Date{ public: Date(int y,int m,int d); Date(); void show(); void init(); private: int year; int month; int day; }; Date::Date(int y,int m,int d){ year=y; month=m; day=d; } Date::Date(){ int y=1900; int m=1; int d=1; year=y; month=m; day=d; } void Date::show(){ cout<<year<<"-"<<month<<"-"<<day<<endl; } void Date::init(){ cin>>year>>month>>day; } int main(){ Date d1,d; Date d2(2100,12,12); d.init(); d1.show(); d2.show(); d.show(); return 0; }
- 1
Information
- ID
- 18405
- Time
- 1000ms
- Memory
- 32MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By