hi in my drive file this is what my constructor looks like. im passing an array to it the constructor so that i can assign it to set[num]. what i want to know is what would this look like in the header file?
drive-file:

IntegerSet::IntegerSet( int a[])
{
	for ( int num = 0; num < 101; num++)
	{
		set[num] = a[num];
	}
}

in the header file would it look like this or is this wrong?

IntegerSet(int);

Try:

IntegerSet(int a[]);

Sodabread's version should work. I would suggest you be careful about array size though so that you don't overrun the boundaries of your arrays. You might consider adding a second "arraySize" parameter that holds the number of valid elements in the array.

You can't pass arrays. You may invoke the constructor with an array in the calling code but what gets passed is a pointer. With-in the context of a function declaration int a[] declares a pointer so IntegerSet::IntegerSet( int a[]) and IntegerSet::IntegerSet( int* a) are equivilent. In both cases the parameter a is a pointer.

Just trying to add clarity and this is also the reason Fbody sensibly sugests passing the size of the array along with the pointer.

Of course this is C++ so you should be avoiding arrays altogether an using vectors which solve the knowing what size it is problem, not to mention your constructor would reduce to something like

IntegerSet::IntegerSet(const vector<int>& a)
: set(a)
{
}

Agreed all around. I need to start posting other suggestions with my solutions =\ My bad.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.