Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I tried to write a findlargest function using recursion and varible ii is the si

ID: 3736201 • Letter: I

Question

I tried to write a findlargest function using recursion and varible ii is the size of array, but it did not work.

I guess my problem is "arr[i]=apple[i].v()" but I don't know why it's wrong

int ii-0 class complexType private: float realnumber-0; float imaginarynumber-0; float value-realnumberrealnumber imaginarynumber imaginarynumber; public: complexType(float real-e,float imaginary 8) real-reaInumber imaginary-imaginarynumber void setcomplex float real, float imaginary rea Inumbererealj imaginarynumber=imaginary; float v() const return value

Explanation / Answer

Instead of using
float arr[] = {0};

Use something like
float arr[10];
OR
float arr[] = {0,0,0,0,0,0,0};
Depending on how may items you want in the array

I'm assuming you're getting an index out of bounds type error, which is a compile time error.