time.h

来自「标准C++编写的小小CRM软件,无任何平台依赖.采用标准XML作为数据库.只需重」· C头文件 代码 · 共 40 行

H
40
字号
// Time.h: interface for the Time class.
//
//////////////////////////////////////////////////////////////////////
#pragma once
#ifndef _TIME_
#define _TIME_

#include <iostream>
#include <strstream>

using namespace std;

class Time{
	friend istream& operator >> ( istream& is, Time& t );
	friend ostream& operator << ( ostream& is, Time& t );
	friend class DateTime;
public:
	Time();
	Time( unsigned h,unsigned m,unsigned s );
	Time( const Time& t );
	Time( char* t );
	void setTime( unsigned h,unsigned m,unsigned s );
	virtual ~Time();
public:
	unsigned getHour()		{	return hour;	}
	unsigned getMinute()	{	return minute;	}
	unsigned getSecond()	{	return second;	}
	bool operator == (const Time& t);	// check the first time equal to the other.
	bool operator >  (const Time& t);	// check the first time later than the follow
	bool operator <  (const Time& t);	// check the first time earlier than the follow
private:
	unsigned hour:5;
	unsigned minute:6;
	unsigned second:6;
};

istream& operator >> ( istream& is, Time& t);
ostream& operator << ( ostream& os, Time& t);

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?