Question
write a program that produces a bar chart showing the population growth of praiereville, a small town in the midwest, at 20-year interval during the
write a program that produces a bar chart showing the population growth of praiereville, a small town in the midwest, at 20-year interval during the past 100 years. The program should read in the population figures(rounded to the nearest 1,000 people) for 1910,1930,1950,1970,1990,2010 from a file. For each year display the date and a bar consisting of one asterisk for each 1000 people. The data can be found in the People.txt file.
Here is an example of how the chart might began:
PRAIRIEVILLE POPULATION GROWTH
(each * represents 1000 people)
1910 **
1930 ****
1950 *****
the people text file has following data.
2000 4000 5000 9000 14000 18000
Here is my code, what am i doing wrong?
#include
#include
#include
using namespace std;
int main()
{
ifstream inputFile;
int number,year = 1910;
inputFile.open("People.txt");
cout << "PRAIRIEVILLE POPULATION GROWTH" << endl;
cout << "(each * represents 1000 people)" << endl;
// Loop through all data found in People.txt file.
while (inputFile>>number&&year<2010)
{
cout << year << ": ";
for(int i=0;, i cout<<"*"; year+=20; cout< } system("Pause"); return 0; }
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