⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 base.h.bak

📁 命令行模式下的简单宾馆管理系统..各种基本功能齐全..属于新人练习作品..hotel manager..
💻 BAK
字号:
/*
 * File: base.h
 * ----------------
 * This file contains a lot Declarations of 
 * basic Functions and Classes.  
 * Each cpp in this project should include this file. 
 */



#ifndef BASE_H
#define BASE_H


#include <fstream>
#include <string>
#include <cstring>
#include <iostream>
#include <ctime>
#include <iomanip>

using namespace std;

/* Constants */
#define max_c 255


/*
 * Function: ReadStringFromFile
 * Usage: ReadStringFromFile(fin,word);
 * --------------------------
 * This procedure reads a string from the fin ifstream,
 * and returns the string to the word. 
 */
void ReadStringFromFile(ifstream *, string &);


/*
 * Class: Date
 * --------------------
 * This class ..
 */
class Date	//get a date..
{
public:
	Date( int = 1, int = 1, int = 1900 );	// constructor.
	void SetDate( int dy, int mh, int yr);	// set the Data.
	int GetDay();	// return the value of day.
	int GetMonth();		// return the value of month.
	int GetYear();	// return the value of year.
	void Print();	// format:day/month/year ? depends you	// print the data.
	int Good();  	// legal date.
	~Date();		// destructor.
private:
	int CheckDay();		// legal day.
	int CheckMonth();	// legal month.
	int CheckYear();	// legal year.
	int day;			
	int month;
	int year;
};



/*
 * Class: Time
 * ---------------
 * This class ..
 */
class Time 	//get a time
{
public:
	Time( int = 0, int = 0, int = 0 );	// constructor.
	void SetTime( int sd, int me, int hr);	// set the time.
	int GetSecond();	// return the value of second.
	int GetMinute();	// return the value of minute.
	int GetHour();	 // return the value of hour.
	int Good();		// legal time.
	void PrintStandard();	// print the time in standard mode.
	void PrintUniversal();	// print the time in universal mode.
	~Time();	// destrucotr.
private:
	int CheckSecond();	// legal second.
	int CheckMinute();	// legal minute.
	int CheckHour();	// legal hour.
	int second;
	int minute;
	int hour;
};


/*
 * Function: Error
 * Usage: Error(errorInfo);
 * --------------------------
 * This procedure prints the error info to the user.
 */
void Error( string ); 


//Declare the curTime.
extern time_t curTime;


/*
 * Function: CharToStr
 * Usage: string=CharToStr(char word[]);
 * --------------------------
 * This function translates the word's format from char[] to string,
 * and returns the value of the string.
 */
string CharToStr( char [] );


/*
 * Function: CharToInt
 * Usage: int=CharToInt(char num[]);
 * --------------------------
 * This function translates the num's format from char[] to int,
 * and returns the value of the int.
 */
int CharToInt( char [] );


/*
 * Function: GetString()
 * Usage: string=GetString();
 * ---------------------------
 * This function gets a legal string from the user,
 * and returns the value of the string.
 */
string GetString();


/*
 * Function: GetInt
 * Usage: int=GetInt();
 * --------------------------
 * This function gets a legal integer from the user,
 * and returns the value of the integer.
 */
int GetInt();


/*
 * Function: GetYesNo
 * Usage: char=GetYesNo();
 * --------------------------
 * This function gets a 'y' or 'n' from the user,
 * and returns the value of the char.
 */
char GetYesNo();

#endif

⌨️ 快捷键说明

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