题目:声明一个表示时间的结构体,可以精确的表示年月日小时分秒;提示用户输入年月日小时分秒的值,然后完整地显示出来。
#include<iostream>
#include<iomanip>
using namespace std;
struct time
{
int year;
int month;
int day;
int hour;
int minute;
int second;
};
void main()
{
cout<<"please input the datas"<<endl;
cin>>time.year>>time.month>>time.day>>time.hour>>time.minute>>time.second;
cout<<time.year<<"年"<<time.month<<"月"<<time.day<<"日"<<time.hour<<"时"<<time.minute<<"分"<<time.second<<"秒"<<endl;
}