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 valueExplanation / 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.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.