#28039 - compound - Tue Oct 26, 2004 2:17 pm
ok i used the following function to generate a number between 1 and 5
int myRandVar = rand() % (5 - 1 +1) + 1;
this number is then used as a parameter to decide on what type of object im going to create
bob.CreateShape(myRandVar);
but for some reason it just produces object 4
ive tried to debug this by displaying it as text but cant onvert the integer to a string using
itoa(myRandVar, bbb, 5 );
it says itoa is an unidentified function when this shows up on cplusplus.coms ref library
ive included al these to make sure
#include <cstdlib>
#include <stdlib.h>
#include <math.h>
i really havent a clue im sure it shouldnt be this difficult
thanks alot
int myRandVar = rand() % (5 - 1 +1) + 1;
this number is then used as a parameter to decide on what type of object im going to create
bob.CreateShape(myRandVar);
but for some reason it just produces object 4
ive tried to debug this by displaying it as text but cant onvert the integer to a string using
itoa(myRandVar, bbb, 5 );
it says itoa is an unidentified function when this shows up on cplusplus.coms ref library
ive included al these to make sure
#include <cstdlib>
#include <stdlib.h>
#include <math.h>
i really havent a clue im sure it shouldnt be this difficult
thanks alot