Program is in C++ Suppose you are building a program which draws several stars o
ID: 3691700 • Letter: P
Question
Program is in C++
Suppose you are building a program which draws several stars on the console. On the first three lines, there should be 1, 2, and 3 stars, respectively. On all subsequent lines, the number of stars should either be twice the number of stars 2/3 of the way up the screen, for lines numbers that are exact multiples of three, or otherwise 2 more than the preceding line. Write a recursive definition for the number of stars on each line.
Then, implement the recursive function from above, add a method to draw any number of stars (that can be iterative, i.e. using a loop, or it can be recursive), and call it enough times print stars on 54 lines.
The first few lines should look like this:
Explanation / Answer
#include using namespace std; int main() { int i,j,rows; coutrows; for(i=1;iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.