Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For my programming class, we have to do the following, however, I've not been able to come up with a way to code this practice

For my programming class, we have to do the following, however, I've not been able to come up with a way to code this practice set by only using loops and IF statements. Any help would be appreciated!

Write a C++ program that will read in a file of states and populations. When the program has read through the complete file, it will display the following information:

  • the city and population with the smallest population
  • the city and population with the largest population
  • the city name and population that would appear first in an ascending list
  • the city name and population that would appear last in an ascending list
  • the number of states listed in the input file
  • the average population of the states listed in the input file

The input file is named StateDemographics.txt and is located in the current directory. The input file consists of the name of the state on one line and its respective population on the next line. Do not store all the information from the input file. Only store the information listed above

StateDemographics.txt

Colorado 5842076

Oregon 4283747

Texas 27469114

New Jersey 8791894

Wisconsin 5686986

New Hampshire 1359711

Virginia 8626210

Missour i5988927

Georgia 3989167

Vermont 600412

South Dakota 899174

Washington 7656200

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

Visual C# And Databases

Authors: Philip Conrod, Lou Tylee

16th Edition

1951077083, 978-1951077082

More Books

Students also viewed these Databases questions

Question

What are Measures in OLAP Cubes?

Answered: 1 week ago

Question

How do OLAP Databases provide for Drilling Down into data?

Answered: 1 week ago

Question

How are OLAP Cubes different from Production Relational Databases?

Answered: 1 week ago