Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

OCA Oracle Database SQL Exam Guide Exam 1Z0-071

Authors: Steve O'Hearn

1st Edition

1259585492, 978-1259585494

More Books

Students also viewed these Databases questions

Question

=+How do they differ from an HR point-of-view?

Answered: 1 week ago