Question: An Introduction to Programming With C++ 8th Edition by Diane Zak Exercise 36: Follow the instructions for starting C++ and viewing the SwatTheBugs36.cpp file, which

An Introduction to Programming With C++ 8th Edition by Diane Zak

Exercise 36:

Follow the instructions for starting C++ and viewing the SwatTheBugs36.cpp file, which is contained in either the Cpp8\Chap11\SwatTheBugs36 Project folder or the Cpp8\Chap11 folder. (Depending on your C++ development tool, you may need to open the project/solution file first.) Run the program. The program should display the total amount in inventory, but it is not working correctly. Debug the program.

_______________________________________

ORIGINAL CODE TO BE DEBUGGED

#include

using namespace std;

int main() { int inventory[10] = {34, 50, 75, 65, 89, 50, 25, 48, 35, 67}; int total = 0;

for (int sub = 1; sub < 10; sub += 1) total =+ inventory[sub]; //end for cout << "Total amount in inventory: " << total << endl; return 0; } //end of main function

____________________________________

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!