Question: Introduction to Programming with C++ 8th Edition Chapter 13 Exercise 37 - Swat The Bugs. Follow the instructions for starting C++ and viewing the SwatTheBugs37.cpp

Introduction to Programming with C++ 8th Edition Chapter 13 Exercise 37 - Swat The Bugs.

Follow the instructions for starting C++ and viewing the SwatTheBugs37.cpp file, which is contained in either the Cpp8\Chap13\SwatTheBugs37 Project folder or the Cpp8\Chap13 folder. (Depending on your C++ development tool, you may need to open the project/solution file first.) The program should calculate and display the total of the prices entered by the user. Run the program. Use your own data to test the program. Notice that the program is not working correctly. Debug the program.

ORIGINAL PROGRAM CODE TO BE DEBUGGED______________________________________

#include #include #include using namespace std;

int main() { string item = ""; double price = 0.0; double total = 0.0;

cout << "Item name (X to end): "; getline(cin, item);

while (item != "X" && item != "x") { cout << "Item price: "; cin >> price; total += price; cout << "Item name (X to end): "; getline(cin, item); } //end while

cout << fixed << setprecision(2); cout << "Total: $" << 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!