Question: C++ Function PrintBroccoliWeight() takes an integer parameter. Define the second PrintBroccoliWeight() function to take the double parameter broccoliWeight. The second function prints the following in

C++

Function PrintBroccoliWeight() takes an integer parameter. Define the second PrintBroccoliWeight() function to take the double parameter broccoliWeight. The second function prints the following in order, all on one line: "Broccoli weight to one decimal place: " the double parameter to one decimal place " ounces" End with a newline. Ex: If the input is 9 9.5, then the output is: Broccoli weight as a whole number: 9 ounces Broccoli weight to one decimal place: 9.5 ounces Note: cout << fixed << setprecision(1) outputs a double to one decimal place.

```

#include #include using namespace std;

void PrintBroccoliWeight(int broccoliWeight) { cout << "Broccoli weight as a whole number: " << broccoliWeight << " ounces" << endl; }

/* Your code goes here */

int main() { int broccoliWeight1; double broccoliWeight2;

cin >> broccoliWeight1; cin >> broccoliWeight2;

PrintBroccoliWeight(broccoliWeight1);

```

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!