📄 time.h
字号:
// 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -