Code /* RecursiveLargest.cpp CIS 250 Dave Klick 2008-03-24 This program uses recursion to find the largest element in an array. */ #include #include using std::cout; using std::endl; int largest(int[], int hi, int lo); int main(void) { int num[] = { 24, -87, 0, 97, -65, -2, -5, 76, 23, 1, 23 }; for (int i=0; i<11; i++) cout << largest(num,0,i) << '\n'; return 0; } int largest(int list[], int lo, int hi) { assert (hi>=lo); int max = list[lo]; if (hi != lo) { max = largest(list, lo+1, hi); if (list[lo] > max) max = list[lo]; } return max; }