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

Write a function called printStars . The function receives an int parameter. If

ID: 3640102 • Letter: W

Question

Write a function called printStars . The function receives an int parameter. If the parameter is positive, the function prints (to standard output) the given number of asterisks; otherwise the function does nothing. The function does not return a value. Thus, if the printStars(8) is called, ******** (8 asterisks) will be printed.

The function must not use a loop of any kind (for, while, do-while) to accomplish its job. Instead, it gets the job done by examining its parameter, returning if the parameter's value is not positive. If the parameter is positive, it
prints a single asterisk (and no other characters)
then (recursively) calls itself to print the remaining asterisks.

Explanation / Answer

#include using namespace std; void printStars(int n) { if(n
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