Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Programming Language: C++ Example Output function prototypes go here const int ARRAY_SIZE = 20; main() //declare the array int numberList[ARRAY_SIZE]; int count= 0; //how many

image text in transcribed

Programming Language: C++

Example Output

image text in transcribed

image text in transcribed

function prototypes go here

const int ARRAY_SIZE = 20;

main()

//declare the array

int numberList[ARRAY_SIZE];

int count= 0; //how many elements are in the array

int choice;

do

choice = displayMenu (this function will return the user's choice)

switch on choice

case 1

increment the count

if count

call function to add a number to the list - pass it the array and count

else

display error message that array is too big

break

case 2

call function to display the list - pass it the array and count

case 3

call function to display the list backwards - pass it the array and count

case 4

call function to sum up the numbers in the list - pass it the array and count

case 5

call function to say "good bye"

default

handle incorrect choice (ie, choice not 1-4)

end switch

while (choice not equal to 5)

end main

Please create a menu-driven program that offers the user a chance to play with a list of numbers: . Add one number to the end of the list 2. Display the list Display the list backwards 4. Display the sum of all the numbers in the list 5. Exit the Numbers List Game Here are the rules When the program starts, the list is empty Keep the menu looping around until the user wishes to stop. All numbers must be positive integers. Allow no more than 20 numbers to be added to the list in any given run of the program. Don't allow the program to crash - keep a counter. Display the list. Either put a space between each number or put one number per line so that it's easy to read. Make all of the output beautiful Menu Option3 Display the list backwards. Either put a space between each number or put one number per line so that it's easy to read. Make all of the output beautiful. Add up all the numbers in the list and display that number. Programming Rules: You must use an array to hold the list of numbers. That array must be declared in main0 and then passed around to the various functions Your code must be divided into logical functions - use a separate function to implement each menu option. No global variables. Global constants are okay. All good programming practices should be in place

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

Step: 3

blur-text-image

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

Spomenik Monument Database

Authors: Donald Niebyl, FUEL, Damon Murray, Stephen Sorrell

1st Edition

0995745536, 978-0995745537

More Books

Students also viewed these Databases questions

Question

=+ What jobs we will need in the future?

Answered: 1 week ago