Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Writo a program that producos tho output shown, based on the following information. OUTPUT Enter 4 cities: Corona Anaheim Santa Ana Brea gotCitios0 function How

image text in transcribed

image text in transcribed

Writo a program that producos tho output shown, based on the following information. OUTPUT Enter 4 cities: Corona Anaheim Santa Ana Brea gotCitios0 function How do you want to aee the cities displayed? Enter 0 for In order, or R for In Reverse (R): O- User enters Here are the citien in order: gotChoice0 function displayinOrdo:0 function corona Anaheim Santa Ana Brea Run program again (y / n) ? y (User ontersy (screen clearo) --..-.--- Enter 4 cities: Riverside Long Beach Orange Norco getCities0 function How do you want to see the cities displayed? getChoice0 function Enter O for In Order, or R for In Reverse (R): RJUser enters R Here are the cities in reverse order displayinOrder0 function Norco Orange Long Beach Riverside Run program again (y / n)? y User enters n Press any key to continue/ Based on the output on pago 1, write a program that does the following: This program uses an array to hold tho names of 5 citios. Tho program asks tho usor to ontor 5 citios, which aro read and assigned to an array. The rosults can bo displayod in ordar or in reverse order, deponding on tho usor's choico (soo output) 1.) In main0. declare an array that can hold up to 5 string valucs. Namo the array: cities - 2.) Includo 4 functions getCities This function prompts tho usor to ontor 5 citios, which aro road and assignod to tho ages array o Tho citios array is passod by roferonco to tho function o Tho function is void-returning getChoice This function prompts tho usor to enter a choice of how the array values should bo displayed, oither in order (O), or in reverse order (R) oNo arguments are passed to the function. o The function returns a value reprosenting the usor's choico. (seo output) Only one of the following two functions will got callad-deponding on the usor's choice. If the user enters or o, the array is displayed in order - display!nOrderO is called. Note: Use a switch or il-else statement in mainO to determine which function is called. o If the user enters R or r, the array is displayed in reverso order-displayinReverse0 o lf the user enters a value other than 0 or A, this message is displayed: Invalid entry Must be O or R displayinOrder This function displays the array values in order, with elemontO) first. o The cities array is passed by reference to the function. o The function is void-returning. displayinReverse This function displays the values in reverse order, with element[4] first oThe cities array is passed by reference to the function. o The function is void-returning Copy and paste the output below your source code. Aleo,rememher toIncludo o

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

Spatial Database Systems Design Implementation And Project Management

Authors: Albert K.W. Yeung, G. Brent Hall

1st Edition

1402053932, 978-1402053931

Students also viewed these Databases questions

Question

Write a letter asking them to refund your $1,500 down payment.

Answered: 1 week ago