utility.h

来自「链表和应用包括单链表和双链表等等。自己写的」· C头文件 代码 · 共 39 行

H
39
字号
#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 + =
减小字号Ctrl + -
显示快捷键?