Suppose the function from Display 3.7 has the return statement removed. Which of the statements below regarding this change are correct? Why?

```
void iceCream(int number, double totalWeight)
{
if(number == 0)
{
cout << “cannot divide among zero customers.\n”;
return;
}
portion = totalWeight/number;
cout << “Each one receives “
<< portion << “ ounces of ice cream.” < ```
a) The code will not compile.
b) The code will compile and run. The output will be unchanged.
c) The code will compile. For a zero number of customers the code would produce a
divide by zero run-time error.
d) The program will compile and run correctly for 1 or more customers. The error
for zero number of customers could be repaired by placing an else after the
block belonging to the if.

c) The code will compile. For a zero number of customers the code would produce a
divide by zero run-time error.
d) The program will compile and run correctly for 1 or more customers. The error
for zero number of customers could be repaired by placing an else after the
block belonging to the if.

Computer Science & Information Technology

You might also like to view...

After a chart is created in Excel, it can be copied and pasted into other applications.

a. true b. false

Computer Science & Information Technology

When using Synchronous Scrolling, what do you click to change the two document windows back to the original side-by-side viewing size?

A) Reset Window Position B) Restore Window Position C) Reset Windows D) Restore Windows

Computer Science & Information Technology