Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write this code in C++. DO Not write it in C or any other languages. NO USE OF STL(OR ANY VECTOR TYPE). The file

Please write this code in C++. DO Not write it in C or any other languages. NO USE OF STL(OR ANY VECTOR TYPE). The file of the data is written down below.

image text in transcribed

The US Census provides data regarding the population of the United States. Contained in the file "countyPop.dat" stored in the class directory on cs1 are the 2010 population numbers for all of the counties in the United States. You are to read the data into an array, then use MergeSort to sort the values by population, e'ither in non-descending or non-ascending order (your choice) Before sorting, print the first ten and last ten records to the screen. To read the file use this: const string INPUTFILE "/home/fac/sreeder/class/cs2430/countyPop.dat"; Once the entire set is sorted, print the first ten and last ten records to the screen. (Perhaps a print function?) The data file contains the population from the 2010 census followed by the name of the county and its state, as in: 34690 Clark County, Wisconsin. Each county information is on its own line There are less than 3,200 lines of information To read the file, use the following while loop (assuming all variables are properly declared and initialized): while (infile>list[count.censusCount) etline(infile, list[countl.place) count++; Note that you can read the county name and state name into the same feld n the struct. There is no need to separate them. So your struct only needs two fields -the population and the 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

Business Process Driven Database Design With Oracle PL SQL

Authors: Rajeev Kaula

1st Edition

1795532386, 978-1795532389

More Books

Students also viewed these Databases questions