?? base.h
字號(hào):
/*
* 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 <cstring>
#include <iostream>
#include <ctime>
#include <cstdlib>
#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
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -