| | |
Compiler error
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Sep 2004
Posts: 2
Reputation:
Solved Threads: 0
Greetings:
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 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.
You were doing fine up until this routine:
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. :-)
C++ Syntax (Toggle Plain Text)
int recursiveMinimum(int[] array, int size) { if size<=1 return -1; if array[index]<smallest smallest=array[index]; index++; 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. :-)
![]() |
Similar Threads
- Help with compiler error for self-teacher (C++)
- Compiler Error: Undefined References; Codeblocks (C++)
- compiler error when address of a pointer is passed (C)
- Borland compiler error (C++)
- Compiler error ?? (C++)
- Compiler error with Dev-C++ (C++)
- internal compiler error (C++)
- HELP- internal compiler error? (C++)
Other Threads in the C++ Forum
- Previous Thread: SHA1-One-Way Hash
- Next Thread: beginner
| Thread Tools | Search this Thread |
api application array arrays based beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete deploy developer dll dynamiccharacterarray email encryption error file forms fstream function functions game generator getline givemetehcodez graph homeworkhelp homeworkhelper iamthwee ifstream input int java lib list loop looping loops map math matrix memory multiple newbie news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg simple sorting string strings temperature template text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






