first off, YES THIS IS HOMEWORK so anyone put off by that can stop reading right now.....
i'm supposed to write a recursive function that will take 2 numbers and print out a series of * based on those....basically what it boils down to is something like
triangle(cout, 3, 5);
would display
***
****
*****
****
***
i can get up to that third line there but the going back down part is confusing me and i would greatly appreciate any help.
here's what i have so far.....
Code:void triangle(ostream& outs, int m, int n){ int i; for(i=0;i<m;i++) outs << "*"; cout << endl; if(m != n) { triangle(outs, m+1, n); } }




Reply With Quote