1 条题解
-
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
信息
- ID
- 2863
- 时间
- 1000ms
- 内存
- 32MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者