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

📄 pch.h

📁 标准的GP源代码,由Andy Singleton维护
💻 H
字号:
// pch.h   Adapted from GPQUICK-2.1// W. Langdon cs.ucl.ac.uk 5 May 1994 (21 Feb 95 make it inline)// Use Park-Miller random numbers// QPQUICK// Standard header files for compilers supporting Pre-Compiled Headers#ifndef _PCH_H#define _PCH_H// Pick your compiler.  DOS/ANSI by default, now defined for UNIX#define UNIX#include <stdlib.h>#ifdef UNIX#include <stream.h>#include <strstream.h>#else#include <conio.h>#include <strstrea.h>#endif#include <ctype.h>#include <iostream.h>#include <iomanip.h>#include <fstream.h>#include <math.h>#include <float.h>#include <time.h>#include <stdio.h>#include <string.h>#include <values.h>#ifndef TRUE#define TRUE 1#define FALSE 0#endif#define BOOL int//////////  Random number functions cause portability problems.  Resolve here.// Define	rand_0to1()  (random float from 0 to 1)//			rnd(x) (random integer from 0 to x-1)//			rndomize() (initialize with a time based seed) 			// park-miller.cc   Park-Miller random number generator// W. Langdon cs.ucl.ac.uk 5 May 1994inline int intrnd (int& seed) // 1<=seed<=m{#ifdef LONG_GE46BITSint const a    = 16807;      //ie 7**5int const m    = 2147483647; //ie 2**31-1	seed = (long(seed * a))%m;	return seed;#elsedouble const a    = 16807;      //ie 7**5double const m    = 2147483647; //ie 2**31-1	double temp = seed * a;	seed = (int) (temp - m * floor ( temp / m ));	return seed;#endif}#ifdef UNIX//////////////////// UNIX stuff#define INT32 intinline int kbhit() {return FALSE;}  // remove this MS DOS function//May well work with Turbo C as well	extern int gpquick_seed;        inline float rand_0to1()                { return (float)(intrnd(gpquick_seed)) / 2147483647.0; }	inline int rnd(int __num)		{ return (intrnd(gpquick_seed) % __num); }	inline void rndomize(void)		{ do {			gpquick_seed = (unsigned) time(NULL);		     } while (gpquick_seed <= 0);                }#else//////////////////// DOS/ANSI stuff#define INT32 long#define rand_0to1() (((float)rand())/RAND_MAX)#ifndef __TURBOC__	inline int rnd(int __num)		 { return(int)(((long)rand()*__num)/(RAND_MAX+1)); }	inline void rndomize(void) { srand((unsigned) time(NULL)); }#else//////////////////// Borland C++ stuff#define rnd(x) random(x)#define rndomize() randomize()#endif#endif#endif

⌨️ 快捷键说明

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