请人编一个简单的C++程序(内详)

来源:百度知道 编辑:UC知道 时间:2024/06/11 00:36:57
定义一个时间类Time, 能够提供和设置由时.分.秒组成的时间.并编出应用程序,定义时间对象,设置时间,输出该对象提供的时间,并将其定义为接口,用多文体结构实现.
不是很难 就是我们刚开始学 我还不知道怎么弄
开始是class Time......

很好,这个与具体的plantform
有关,你要什么的。

有三个文件
//1、DealTime.h
#ifndef CAESAR_DEALTIME_H__DEF
#define CAESAR_DEALTIME_H__DEF
#include <time.h>
//this is a class based on second,that can handle time operater
class CDealTime
{
public:
CDealTime(); //use current time
CDealTime(time_t tm); //use time_t time
CDealTime(int nYear, int nMonth, int nDay, int nHour, int nMin, int nSec); //use specif time
virtual ~CDealTime();

public: //
static CDealTime GetLocalTime();

public: //for get value
time_t GetTime() const; //gain time_t value
int GetYear() const; //gain year
int GetMonth() const; //gain month
int GetDay() const; //gain day
int GetHour() const; //gain hour
int GetMinute() const; //gain minute
int GetSecond() const; //gain second
int GetDayOfWeek() const; //gain the current day of week(from 1 to 7)
int GetDayOfMonth() const; //