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

I am trying to Overload the << operator so it would print out my array recursive

ID: 3568433 • Letter: I

Question

I am trying to Overload the << operator so it would print out my array recursively. Having a lot of trouble.

Can anyone type out an overloading class method that overloads << to print out an array using recursion.

To clarfiy, you only have an array[5] private member in the class. your << operator should print that out recursivly. Given the program there are no accessors or mutators, but I did attempt to add them unless there is a way to do so without.

This is what I attempted.

int recursionAlgo::getarray(){
for(int i=0;i<=4;i++){
cout<<array[i]<<" ";}
}

ostream& operator<<(ostream& os, recursionAlgo& rhs){
return (os<<rhs.getarray());
}

Explanation / Answer

#include #include #include template struct Array { typedef std::vector type; template friend std::ostream &operator
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote