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
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
Get step-by-step solutions from verified subject matter experts
