Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Program 1 from the textbook > ( 5 marks ) Write a C + + program that prompts the user to enter three cities and
Program from the textbook marks
Write a program that prompts the user to enter three cities and displays them in ascending
order.
Sample Run:
Enter the first city: Chicago
Enter the second city: Los Angeles
Enter the third city: Atlanta
The three cities in alphabetical order are: Atlanta, Chicago, Los Angeles
Program marks
Let moneytxt be a text file that contains amounts of money spent on clothes. Assume the num
ber of values stored in the file in unknown. Write a complete C program that reads the money
amounts from the text file and outputs the following information to the console:
The number of values stored in the file
The number of money amounts that are in the interval
The number of money amounts that are in the interval
The number of money amounts that are in the interval
Example: if the values stored in the file are:
then your program should print out:
The number of values stored in the file is
The number of money amounts that are in the interval is
The number of money amounts that are in the interval is
The number of money amounts that are in the interval is
Note: test if the text file is opened correctly.
Hint: use a while loop.
Question on Program : Mark
Briefly explain what would be changed if we were to output the information to a text file instead
of the console? do the code for both programs and answer the question at the bottom
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