|
|
|
© 1998 by Bobby Griggs.
#if !defined(MYPROCS_H)
#define MYPROCS_H
#include < time.h >
#include < conio.h >
#include < stdio.h >
void Delay(long);
bool Again();
void Swap(int &a,int &b);
void Delay (long delay)
{
long initialtime = time(NULL), delta = 0;
while (delta < delay)
{
delta = time(NULL) - initialtime;
}
return;
}
bool Again()
{
char c;
cout << "Press esc to exit, any other key to continue ... ";
cout << endl;
c = getche();
if ((int)c == 27)
return false;
else
{
if ((int)c == 13)
c = getchar(); // this is used to flush keyboard buffer
cout << endl << endl;
return true;
}
}
void Swap(int &a,int &b)
{
int hold;
if (a > b)
{
hold = a;
a = b;
b = hold;
}
return;
}
#endif
|