Answered! Get a copy of the functionP.cpp. The purpose of this program is to practice using user defined functions….

Get a copy of the functionP.cpp.

The purpose of this program is to practice using user defined functions.

Don't use plagiarized sources. Get Your Custom Essay on
Answered! Get a copy of the functionP.cpp. The purpose of this program is to practice using user defined functions….
GET AN ESSAY WRITTEN FOR YOU FROM AS LOW AS $13/PAGE
Order Essay

——————————————————————————————————————————————————————

// Program functionP prints a triangle of the stars.
// For example:  
//               *****
//               ****
//               ***
//               **
//               *

#include <iostream>
#include <iomanip>
using namespace std;

/* FILL IN the function prototype for PrintStars */

int main ()
{
    int  numofstars;

    cout << "Enter the number of stars in the first line: " << endl;
    cin >> numofstars;

    while (numofstars > 0)
    {

    /* FILL IN code to invoke function PrintStars */

    /* Update the control variable   numofstars  */ 

    }

    return 0;
}

//****************************************************************************

void PrintStars(int NUM)
{
  /* FILL IN Code to print the number of NUM stars in a line by using a loop*/
}

—————————————————————————————————————————————————————————-

Add code to the program to complete it.

Compile and run this C++ program.

Expert Answer

 #include <iostream>

#include <iomanip>

using namespace std;

/* FILL IN the function prototype for PrintStars */
void PrintStars(int);

int main ()
{
int numofstars;

cout << “Enter the number of stars in the first line: ” << endl;
cin >> numofstars;

while (numofstars > 0)
{
/* FILL IN code to invoke function PrintStars */
PrintStars(numofstars);

/* Update the control variable numofstars */
numofstars = numofstars -1;
}

return 0;
}

//****************************************************************************

void PrintStars(int NUM)
{
/* FILL IN Code to print the number of NUM stars in a line by using a loop*/
for(int count=0; count < NUM; count++) {
cout << “*”;
}
cout << endl;
}

Answered! Get a copy of the functionP.cpp. The purpose of this program is to practice using user defined functions.... 1

Still stressed from student homework?
Get quality assistance from academic writers!