📄 utility.h
字号:
#ifndef UTILITY_H
#define UTILITY_H
#include <iostream> //standard iostream operations
#include <limits> //numeric limits
#include <cmath> //mathematical functions
#include <cstdlib> //C-string functions
#include <cstddef> //C library language support
#include <fstream> //file input and output
#include <cctype> //character classification
#include <ctime> //data and time functions
using namespace std;
bool user_says_yes()
{
int c;
bool initial_response = true;
do { //Loop until an appropriate input is received.
if(initial_response)
cout<<"(y,n)? "<<flush;
else
cout<<"Respond with either y or n: "<<flush;
do { //Ignore white space.
c = cin.get();
} while (c == '\n'|| c== ' ' ||c == '\t');
initial_response = false;
} while (c !='y'&&c != 'Y' && c !='n'&& c != 'N');
return(c == 'y'|| c== 'Y');
}
enum Error_code{success, fail, range_error, underflow, overflow, fatal,
not_present, duplicate_error, entry_inserted, entry_found,
internal_error};
#endif UTILITY_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -