Question
C++ not using classes Create a function named ReadCities, which takes a string input filename and string output filename as a parameters. This function returns
C++ not using classes
Create a function named ReadCities, which takes a string input filename and string output filename as a parameters. This function returns the number of cities read from the file. If the input file cannot be opened, return -1 and do not print anything to the output file. Read each line from the given filename, parse the data, process the data, and print the required information to the output file. Each line of the file contains CITY, STATE, POPULATION, ELEVATION. Read the data and print the city with the largest population and the city with the highest elevation. If given the data below: Seattle, Wash., 668342, 429 Denver, Colo., 663862, 5883 Washington, DC, 658893, 16 Indianapolis, Ind., 848788, 797 New York, N.Y., 8491079, 13 Los Angeles, Calif., 3928864, 126 Your output file should contain: Largest: New York City, 8491079 Highest: Denver, 5883 You only need to write the function code. Our code will create and test your class.
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