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
A construction-based client would like to develop an application that can analyze an image of machinery and overlay information
Elden [556K]

A form of Extended Reality which can best assist the client with information on the repair is: 3. Augmented Reality.

<h3>What is Extended Reality?</h3>

Extended reality refers to an umbrella terminology that is used to describe all real and virtual physical environments (realities) and human-machine interactions through the use of computer technologies and wearables.

<h3>The forms of Extended Reality.</h3>

In Computer technology, there are four (4) main types of Extended Reality and these include:

  • Mixed Reality
  • Haptic Reality
  • Virtual Reality
  • Augmented Reality

Augmented Reality is mainly applied in maintenance and repair by analyzing an image of machineries and provide information that will assist in the repair process.

Read more on Augmented Reality here: brainly.com/question/9054673

4 0
3 years ago
1. Do you believe that films today are still art? Why or why not?
erastovalidia [21]
No because your not learning anything
6 0
3 years ago
Marta, an art director, wants to give feedback to her graphic designer on his logo design. To be effective her feedback should b
Lana71 [14]

Answer:

B. Specific and provided during the construction of the project, and the end of the project.

Explanation:

The feedback have to be specific and provided during the construction of the project, and at the end of the project.

8 0
3 years ago
Read 2 more answers
Once a virus has been removed by your anti-virus program, all traces of it are gone from your computer.
pychu [463]
Im pretty sure that is false
5 0
3 years ago
Chris is responding to a security incident that compromised one of his organization's web servers. He believes that the attacker
Aloiza [94]

The cybersecurity objective that the above attack violate is known as Integrity.

<h3>What is Cybersecurity aims?</h3>

Their objectives is majorly to protect any computers system, networks, and other kinds of software programs from any type of cyber attacks.

Note that The cybersecurity objective that the above attack violate is known as Integrity as they are not the kind of people that keep to their words.

Learn more about cybersecurity from

brainly.com/question/12010892

#SPJ1

3 0
2 years ago
Other questions:
  • How many possible values will an eight bit audio sample have
    14·1 answer
  • A ________ editor was the dominant way film was edited up until the early '90s.
    7·2 answers
  • ________ management is a process of controlling changes in system requirements during software development.
    9·1 answer
  • Explain at least one reason why programming languages have functions
    12·1 answer
  • Which of the following is an example of synchronous communication?
    5·1 answer
  • GDP measures the production levels of any nation. This implies a correlation between production levels and ____________.
    8·1 answer
  • Player casts 'Assassinate' on 'Acolyte of pain'. Acolyte's owner will:
    6·2 answers
  • Should the use of hacktivists by a country against enemy organizations be considered an act of war? Why or why not? How about th
    8·1 answer
  • ANo _____ works by using the Internet to relay communications; it maintains privacy through security procedures and tunneling pr
    12·1 answer
  • I will give Brainliest to whoever answers correctly :3
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!