Answered step by step
Verified Expert Solution
Question
1 Approved Answer
dev C++ Question 135 Marks You are given a CH program (Debug.cpp) with errors (syntax errors and/or logical errors, if any). The program has three
dev C++
Question 135 Marks You are given a CH program (Debug.cpp) with errors (syntax errors and/or logical errors, if any). The program has three (3) user-defined functions as listed below: Function Name getMenu getPrice Pas Description The function asks the users to enter a menu name and then return the menu name as a string pointer-type variable. The returned menu name is later assigned as an item of string pointer type array variable named menus The function accepts two arguments. The first argument is the caption text to guide users to enter the price or the pieces' number of chicken on the menu. The second argument is either the price of the piece of chickens which were represented by an array of integer pointer type variables: price and pos. The getPricePes function assigns data entered by the users to the corresponding item of these array variables The function accepts three arguments that are the menus, price, and pes parallel array pointer-type variables. It calculates the price for one piece of chicken on cach menu (price/pos) and then returns the index number of array items which representing the cheapest menu (menu with lowest price for one piece of chicken) cheapestMenu The main function of the program has a series of calls to getMenu and getPricePos functions inside a loop control structure. The menus, price, and pcs are parallel pointer type arrays with references to their item's index was made based on variable used to control the loop (loop which used to make a series of call to getMenu and getPricePcs functions). Some of the output was produced by a call made to cheapestMenu function. The last part of the output produced after the index number of parallel aay items representing the cheapest menu was returned by the cheapest Menu function. You are required to debug the errors, compile, and run the program You are NOT ALLOWED to remove any statements in the program. You are only allowed to update the statements provided in the program and add a new statement(s) if absolutely necessary The program should produce the outputs as in Figure 1. Note: The values in bold are input by the user 2 3 7/Debug.cpp Binelude 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