#include<iostream> using namespace std; class Yearcat{ public: void setTime(int newY=0,int newM=0,int newD=0); void showTime(); private: int Year,Month,Day; }; void Yearcat::setTime(int newY,int newM,int newD){ Year=newY; Month=newM; Day=newD; } inline void Yearcat::showTime(){ cout<<Year<<":"<<Month<<":"<<Day<<endl; } int main(){ Yearcat myyear; int a,b,c; cout<<"First time set and output:\n"<<"请输入: a,b,c"<<endl; cin>>a>>b>>c; myyear.setTime(a,b,c); myyear.showTime(); return 0; }