I actually got your first source code post to work with a few modifications. First was to add a constructor call to rng.cpp ( aRandomNumberGenerator::aRandomNumberGenerator() ), second was to remove...
Type: Posts; User: skreaminskull
I actually got your first source code post to work with a few modifications. First was to add a constructor call to rng.cpp ( aRandomNumberGenerator::aRandomNumberGenerator() ), second was to remove...
Add a constructor call in rng.cpp after
using namespace std;
aRandomNumberGenerator::aRandomNumberGenerator() {
}
You need to pass something to your setSeed() function...you have it defined as
void aRandomNumberGenerator::setSeed(unsigned long) in rng.cpp. Something like this in main.cpp
rand.setSeed(1);
I think you are getting the first error,
C2011: 'aRandomNumberGenerator' : 'class' type redefinition
because you the way main.cpp is included rng.h and rng.cpp. Even though you have the header...
Thanks Mats!
Point well noted...I think I'm starting to get it.
The way I am understanding this is that in the first code example, p2 is storing the the value of z in its own memory address...
Thank you laserlight and matsp!
Right, I was trying to get p2 to be a pointer to z and get in some practice with malloc. With my misunderstanding of pointers though, I thought I needed to point...
Hello all,
This is my first post...I'm just starting to learn C and going through some of the beginner tutorials at cprogramming.com. The following code is giving me an error at run time
...