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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started