//
#include
#include
#include
#define N 2500
#define N2 10000000
static int allocated;
/**
* Class RandNum
*
* Provides random numbers based on the second-order linear
* congruential generator that we've always used. Initialization
* constants are suggested by J. G. Skellam.
*/
class RandNum
{
// The current value of the random number generator.
public:
int *currval;
/**
* constructor **
*/
// The constructor merely initializes the current value.
RandNum()
{
currval = new int[2]; // Allocate array.
currval[0] = 13;
currval[1] = 117;
}
/**
* next
*
* Returns the next random number in the sequence.
*/
int next()
{
int temp; // Holds intermediate calculations.
temp = (currval[0] * 254754 + currval[1] * 529562) % 999563;
currval[1] = currval[0];
currval[0] = temp;
return (temp);
}
/**
* nextwc
*
* Returns next random number, but with a ceiling.
*/
int nextwc(int ceiling)
{
return(next() % ceiling);
}
/**
* abs_nextwc
*
* Returns next random number with ceiling; applies absolute value
* function on the way out.
*/
int abs_nextwc(int ceiling)
{
int temp;
temp = nextwc(ceiling);
return (abs(temp));
}
};
//
class testclass
{
public:
char *bytes;
testclass(int n)
{
bytes = new char[n];
allocated++;
}
~testclass()
{
delete bytes;
allocated--;
}
};
//
class testclass1
{
public:
int func(int t)
{
t=t+1;
return(t);
}
};
//
class testclassr
{
public:
int a;
virtual int func(int t)
{
t=t+2;
return(t);
}
};
//
class testclass2: public testclassr
{
public:
virtual int func(int t)
{
t=t+1;
return(t);
}
};
int main (void)
{
int i,k,r;
unsigned long time;
int which;
RandNum rndnum;
testclass *test[N];
int msecs = CLOCKS_PER_SEC/1000;
int total_time;
testclassr *tt0;
testclass1 *tt1;
testclass2 *tt2;
time = clock();
//
allocated=0;
for(k=0;k<1;k++)
{
for(i=0;i
total_time=0;
for(k=0;k<10;k++)
{
time = clock();
for(i=0;i
r=0;
tt0 = new testclassr;
time = clock();
for(i=0;ifunc(0);
cout<func(0);
cout<func(0);
cout<