1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
marishachu [46]
3 years ago
11

Write a program that produces a bar chart showing the population growth of Prairieville, a small town in the Midwest, at 20-year

intervals during the past 100 years. The program should read in the population figures for 1900, 1920, 1940, 1960, 1980, and 2000 from a file named People.txt. It is understood that the first value represents the population in 1900 (for example, 2,843), the second the population in 1920 and so on. For each year it should display the year, followed by at least one space followed by a bar consisting of one asterisk for each 1,000 people. (The program should round UP so that a population of 1 would generate one asterisk -- as would 1000, while a population of 1,001 would generate two, etc.)
Computers and Technology
1 answer:
Sunny_sXe [5.5K]3 years ago
5 0

Answer:

#include <iostream>

#include <fstream>

using namespace std;

int main()

{

ifstream Inputfile;

Inputfile.open("People.txt"); // Open file

if (!Inputfile) // Test for open errors

{

cout << "Error opening file.\n";

return 0;

}

int Pop; // Population

// Display Population Bar Chart Header

cout << "PRAIRIEVILLE POPULATION GROWTH\n"

<< "(each * represents 1000 people)\n";

for (int Year = 1; Year <= 6; Year++)

{ // One iteration per year

switch (Year)

{

case 1 : cout << "1900 ";

break;

case 2 : cout << "1920 ";

break;

case 3 : cout << "1940 ";

break;

case 4 : cout << "1960 ";

break;

case 5 : cout << "1980 ";

break;

case 6 : cout << "2000 ";

break;

}

Inputfile >> Pop; // Read from file

// calculate one per 1000 people

//cout<<"**"<<Pop<<endl;

while(Pop > 0)

{ // Display one asterisk per iteration

// One iteration per 1000 people

cout << "*";

Pop -= 1000;

}

cout << endl;

}

Inputfile.close(); // To close file

return 0;

}

Explanation:

You might be interested in
When you open a program, the hard drive___
Papessa [141]

Answer:

When you open a program, the hard drive <u>Registers the program and runs the program accordingly. </u>

I hope this helped!

3 0
3 years ago
4) Wilkes continues to discuss the concept of time and how it relates to the type of photography he does. Why do you feel that t
lesya692 [45]

Wilkes photography style is solely focused on time lapse. His pictures from morning to night show the cycle of a day at a place in one image.

We cannot help you with the second problem , as we do not know what you learned in Unit 10.

3 0
3 years ago
How does a typewriter involve math and science?
patriot [66]
You have a specific number of words typed a minute and you need to know the science involved in making it
8 0
3 years ago
Read 2 more answers
Where should a user disable virus protection settings that might prevent the boot area of the hard drive from being altered?
leonid [27]

Answer:BIOS setup

Explanation:

BIOS setup is a program used alter or changes the settings of a computer hardware system,it is in the BIOS setup that the user of a company system can disable the Virus and other forms of protection which prevents the system from performing efficiently. To gain access to the BIOS setup one has to turn off the system and wait for up to 5seconds before turning on,press the Esc key constantly for some time until the Start up menu opens then press the F10 to gain access to the BIOS setup.

3 0
3 years ago
Which of the following would a cyber criminal most likely do once they gained access to a user id and password
Bogdan [553]

Answer:

do something wrong as you

3 0
3 years ago
Other questions:
  • What are some options available when using the Replace feature?
    13·1 answer
  • Of which of the following devices are point, drag, and click actions?
    15·1 answer
  • List and describe four communication tools that are currently popular.
    9·1 answer
  • What is the relationship between interoperability and the other quality attributes highlighted in this book? For example, if two
    5·1 answer
  • Answer this blank:<br><br> Air enters through the mouth or nose, and travels through the _
    14·2 answers
  • What framework provides a simple API for performing web tasks?
    13·1 answer
  • Write a Racket two-way selection structure that will produce a list '(1 2 3) when the first element of a list named a_lst is ide
    13·1 answer
  • I made Pico with a Ray Gun (Next is Dad/Tankman)<br><br> Opinons?
    11·2 answers
  • The term ________ refers to the use of a single unifying device that handles media, Internet, entertainment, and phone needs. Gr
    8·1 answer
  • How to use 2 tabs at once on my Lenovo yoga book?​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!