I am taking my first C++ class and am a little stuck. I keep receiving three compiler errors, but I can't seem to figure them out. Can someone please point me in the right direction.

The assignment is:

Write a C++ program having a recursive function recursiveMinimum that takes an integer array and the array size as arguments and returns the smallest element of the array. The function should stop processing and return when it receives an array of 1 element.

I am attaching my .cpp file.

Thanks to anyone that can assist me.

By the way, God bless all you gurus. If this is a beginner's class, I hate to see the advanced classes.

>I am attaching my .cpp file.
Don't do this. Post the code. If the code is too long, post relevant pieces. Your attachment is very small, so the code is short enough to post.

You were doing fine up until this routine:

int recursiveMinimum(int[] array, int size)
	if size<=1 return -1;
	if array[index]<smallest
	recursiveMinimum(array, size);
	return smallest;

1) should be int array[] not int[] array
2) if statements always have their argument in parens, like "if (size <=1) return -1;"

Next time, please post the exact error message too so we don't have to play compiler for you. :-)

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.