The following code segment should read a list of numbers and compute their product. The value 0 is a sentinel. Although the program is syntactically correct, there are several logic errors which cause the program to work incorrectly. Correct these errors.
```
int product, item;
cout << "Enter numbers to multiply, 0 to stop: " << endl;
while (item == 0)
{
product *= item;
cin >> item;
}
cout << "Their product is " << product << endl;
```
```
int product, item;
product = 1;
cout << "Enter numbers to multiply, 0 to stop: " << endl;
cin >> item;
while (item != 0)
{
product *= item;
cin >> item;
}
cout << "Their product is " << product << endl;
```
You might also like to view...
If you use the Report Wizard, you can only select fields from a single table or query for the report.
Answer the following statement true (T) or false (F)
What are two things you can try if you get stuck during the application stage?
What will be an ideal response?
Encapsulation is the ability to create new data types from existing data types.
Answer the following statement true (T) or false (F)
Which of the following explains why you want to sequence file names that you will use in an animation?
A. To create a faster frame rate when the animation is played B. To allow use of onion skinning C. To create an ease in or out effect as each image displays D. To batch the files for faster import