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

I need a C++ Program Write a recursive function that takes as a parameter a nonn

ID: 3772411 • Letter: I

Question


I need a C++ Program

Write a recursive function that takes as a parameter a nonnegative integer and
generates the following pattern of stars. If the nonnegative integer is 4,
the pattern generated is as follows:


****
***
**
*
*
**
***
****


Also, write a program that prompts the user to enter the number of lines in the
pattern and uses the recursive function to generate the pattern. For example,
specifying 4 as the number of lines generates the preceding pattern.


======================================================


Also is it possible to not get a copy of the code from any of these sites or elsewhere online.

http://www.dreamincode.net/forums/topic/101061-recursive-function-star-pattern
http://cboard.cprogramming.com/c-programming/64880-help-solve-my-easy-c-programing-questions.html
https://community.oracle.com/thread/2116526
http://www.justanswer.com/computer-programming/3a2js-write-c-program-uses-recursive-function-takes.html

Just looking for unique code that can't be found online at a bunch of sites already

Thanks much

Explanation / Answer

program: #include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int i,j,n;
top:
cout<<"Enter number of rows : ";
cin>>n;
if(n%2!=0)
{
cout<<"The triangle is : ";
for(i=n;i>=1;i=i-1)
{
for(j=i;j>=1;j--)
{
cout<<"*";
}
cout<<endl;
}
for(i=3;i<=n;i=i+1)
{
for(j=i;j>=1;j--)
{
cout<<"*";
}
cout<<endl;
}
}
else
{
cout<<"You have entered even number. Please enter odd number to get the desired pattern.";
goto top;
}
getch();
}

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