SlideShare a Scribd company logo
Write a program in c++ 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 will take input from user for population figures (rounded to the nearest 1,000
people) for 1900, 1920, 1940, 1960, 1980, and 2000. For each year it should display the date and
a bar consisting of one asterisk for each 1,000 people.
Here is an example of how the chart might begin:
PRAIRIEVILLE POPULATION GROWTH
(each * represents 1,000 people)
1900 **
1920 ****
1940 *****
After the bar chart, print out the maximum, minimum and average number of population.
Solution
#include
using namespace std;
int main()
{
int year[6]={1900,1920,1940,1960,1980,2000};
long population[6],calc[6];
int i,j;
cout<<"Enter the population for years";
for(i=0;i<6;i++)
{
cin>>population[i]; //input years
}
cout << endl << "PRAIRIEVILLE POPULATION GROWTH";
cout << endl << "(each * represents 1,000 people) " << endl;
for(i=0;i<6;i++)
{
calc[i]= population[i]/1000; //calcualte population per 1000 persons
}
for(i=0;i<6;i++)
{
cout << " "<

More Related Content

More from connellalykshamesb60

Explain how an Annelidian differs from a MolluscanSolutionMoll.pdf
Explain how an Annelidian differs from a MolluscanSolutionMoll.pdfExplain how an Annelidian differs from a MolluscanSolutionMoll.pdf
Explain how an Annelidian differs from a MolluscanSolutionMoll.pdf
connellalykshamesb60
 
DNA s composed of nucleotides that are joined together by covalent bo.pdf
DNA s composed of nucleotides that are joined together by covalent bo.pdfDNA s composed of nucleotides that are joined together by covalent bo.pdf
DNA s composed of nucleotides that are joined together by covalent bo.pdf
connellalykshamesb60
 
Discuss some of the challenges involved in ensuring that critical kn.pdf
Discuss some of the challenges involved in ensuring that critical kn.pdfDiscuss some of the challenges involved in ensuring that critical kn.pdf
Discuss some of the challenges involved in ensuring that critical kn.pdf
connellalykshamesb60
 
Biologically, the term is synonymous with [Choose the term race. refe.pdf
Biologically, the term is synonymous with [Choose the term race. refe.pdfBiologically, the term is synonymous with [Choose the term race. refe.pdf
Biologically, the term is synonymous with [Choose the term race. refe.pdf
connellalykshamesb60
 
Anyone good with linguistics Are the following headlines transitive.pdf
Anyone good with linguistics Are the following headlines transitive.pdfAnyone good with linguistics Are the following headlines transitive.pdf
Anyone good with linguistics Are the following headlines transitive.pdf
connellalykshamesb60
 
A mother and father both have normal karyotypes. The father is color .pdf
A mother and father both have normal karyotypes. The father is color .pdfA mother and father both have normal karyotypes. The father is color .pdf
A mother and father both have normal karyotypes. The father is color .pdf
connellalykshamesb60
 
A man has a condition where all of his gametes undergo nondisjunctio.pdf
A man has a condition where all of his gametes undergo nondisjunctio.pdfA man has a condition where all of his gametes undergo nondisjunctio.pdf
A man has a condition where all of his gametes undergo nondisjunctio.pdf
connellalykshamesb60
 
____ The pigment produced by S. marvel scenes would appear first on t.pdf
____ The pigment produced by S. marvel scenes would appear first on t.pdf____ The pigment produced by S. marvel scenes would appear first on t.pdf
____ The pigment produced by S. marvel scenes would appear first on t.pdf
connellalykshamesb60
 
Write the advantages of using JavaFX with compare to Swing and AWT..pdf
Write the advantages of using JavaFX with compare to Swing and AWT..pdfWrite the advantages of using JavaFX with compare to Swing and AWT..pdf
Write the advantages of using JavaFX with compare to Swing and AWT..pdf
connellalykshamesb60
 
Write a 2 page essay describing what life was like in the Great Depr.pdf
Write a 2 page essay describing what life was like in the Great Depr.pdfWrite a 2 page essay describing what life was like in the Great Depr.pdf
Write a 2 page essay describing what life was like in the Great Depr.pdf
connellalykshamesb60
 
Why do silver nanoparticles of 10 nanometers in diameter have lower m.pdf
Why do silver nanoparticles of 10 nanometers in diameter have lower m.pdfWhy do silver nanoparticles of 10 nanometers in diameter have lower m.pdf
Why do silver nanoparticles of 10 nanometers in diameter have lower m.pdf
connellalykshamesb60
 
Why Computer System Management is so critical for the companies (50.pdf
Why Computer System Management is so critical for the companies (50.pdfWhy Computer System Management is so critical for the companies (50.pdf
Why Computer System Management is so critical for the companies (50.pdf
connellalykshamesb60
 
Which of the following statements is not true about facilitated diff.pdf
Which of the following statements is not true about facilitated diff.pdfWhich of the following statements is not true about facilitated diff.pdf
Which of the following statements is not true about facilitated diff.pdf
connellalykshamesb60
 
Which is not a hypothesis for the origin of virusesThey originated .pdf
Which is not a hypothesis for the origin of virusesThey originated .pdfWhich is not a hypothesis for the origin of virusesThey originated .pdf
Which is not a hypothesis for the origin of virusesThey originated .pdf
connellalykshamesb60
 
1. When does a corporation need a board of directors Who should and.pdf
1. When does a corporation need a board of directors Who should and.pdf1. When does a corporation need a board of directors Who should and.pdf
1. When does a corporation need a board of directors Who should and.pdf
connellalykshamesb60
 
What is the difference between myeloid and lymphoid hemopoiesis.pdf
What is the difference between myeloid and lymphoid hemopoiesis.pdfWhat is the difference between myeloid and lymphoid hemopoiesis.pdf
What is the difference between myeloid and lymphoid hemopoiesis.pdf
connellalykshamesb60
 
Vascular graft You want to design a vascular graft. List some advant.pdf
Vascular graft  You want to design a vascular graft. List some advant.pdfVascular graft  You want to design a vascular graft. List some advant.pdf
Vascular graft You want to design a vascular graft. List some advant.pdf
connellalykshamesb60
 
West Nile Virus1. How is this diseasecondition transmitted (Be f.pdf
West Nile Virus1. How is this diseasecondition transmitted (Be f.pdfWest Nile Virus1. How is this diseasecondition transmitted (Be f.pdf
West Nile Virus1. How is this diseasecondition transmitted (Be f.pdf
connellalykshamesb60
 
Using the provided table interface table.h and the sample linked lis.pdf
Using the provided table interface table.h and the sample linked lis.pdfUsing the provided table interface table.h and the sample linked lis.pdf
Using the provided table interface table.h and the sample linked lis.pdf
connellalykshamesb60
 
The United Nations Security Council, the main decision-making body a.pdf
The United Nations Security Council, the main decision-making body a.pdfThe United Nations Security Council, the main decision-making body a.pdf
The United Nations Security Council, the main decision-making body a.pdf
connellalykshamesb60
 

More from connellalykshamesb60 (20)

Explain how an Annelidian differs from a MolluscanSolutionMoll.pdf
Explain how an Annelidian differs from a MolluscanSolutionMoll.pdfExplain how an Annelidian differs from a MolluscanSolutionMoll.pdf
Explain how an Annelidian differs from a MolluscanSolutionMoll.pdf
 
DNA s composed of nucleotides that are joined together by covalent bo.pdf
DNA s composed of nucleotides that are joined together by covalent bo.pdfDNA s composed of nucleotides that are joined together by covalent bo.pdf
DNA s composed of nucleotides that are joined together by covalent bo.pdf
 
Discuss some of the challenges involved in ensuring that critical kn.pdf
Discuss some of the challenges involved in ensuring that critical kn.pdfDiscuss some of the challenges involved in ensuring that critical kn.pdf
Discuss some of the challenges involved in ensuring that critical kn.pdf
 
Biologically, the term is synonymous with [Choose the term race. refe.pdf
Biologically, the term is synonymous with [Choose the term race. refe.pdfBiologically, the term is synonymous with [Choose the term race. refe.pdf
Biologically, the term is synonymous with [Choose the term race. refe.pdf
 
Anyone good with linguistics Are the following headlines transitive.pdf
Anyone good with linguistics Are the following headlines transitive.pdfAnyone good with linguistics Are the following headlines transitive.pdf
Anyone good with linguistics Are the following headlines transitive.pdf
 
A mother and father both have normal karyotypes. The father is color .pdf
A mother and father both have normal karyotypes. The father is color .pdfA mother and father both have normal karyotypes. The father is color .pdf
A mother and father both have normal karyotypes. The father is color .pdf
 
A man has a condition where all of his gametes undergo nondisjunctio.pdf
A man has a condition where all of his gametes undergo nondisjunctio.pdfA man has a condition where all of his gametes undergo nondisjunctio.pdf
A man has a condition where all of his gametes undergo nondisjunctio.pdf
 
____ The pigment produced by S. marvel scenes would appear first on t.pdf
____ The pigment produced by S. marvel scenes would appear first on t.pdf____ The pigment produced by S. marvel scenes would appear first on t.pdf
____ The pigment produced by S. marvel scenes would appear first on t.pdf
 
Write the advantages of using JavaFX with compare to Swing and AWT..pdf
Write the advantages of using JavaFX with compare to Swing and AWT..pdfWrite the advantages of using JavaFX with compare to Swing and AWT..pdf
Write the advantages of using JavaFX with compare to Swing and AWT..pdf
 
Write a 2 page essay describing what life was like in the Great Depr.pdf
Write a 2 page essay describing what life was like in the Great Depr.pdfWrite a 2 page essay describing what life was like in the Great Depr.pdf
Write a 2 page essay describing what life was like in the Great Depr.pdf
 
Why do silver nanoparticles of 10 nanometers in diameter have lower m.pdf
Why do silver nanoparticles of 10 nanometers in diameter have lower m.pdfWhy do silver nanoparticles of 10 nanometers in diameter have lower m.pdf
Why do silver nanoparticles of 10 nanometers in diameter have lower m.pdf
 
Why Computer System Management is so critical for the companies (50.pdf
Why Computer System Management is so critical for the companies (50.pdfWhy Computer System Management is so critical for the companies (50.pdf
Why Computer System Management is so critical for the companies (50.pdf
 
Which of the following statements is not true about facilitated diff.pdf
Which of the following statements is not true about facilitated diff.pdfWhich of the following statements is not true about facilitated diff.pdf
Which of the following statements is not true about facilitated diff.pdf
 
Which is not a hypothesis for the origin of virusesThey originated .pdf
Which is not a hypothesis for the origin of virusesThey originated .pdfWhich is not a hypothesis for the origin of virusesThey originated .pdf
Which is not a hypothesis for the origin of virusesThey originated .pdf
 
1. When does a corporation need a board of directors Who should and.pdf
1. When does a corporation need a board of directors Who should and.pdf1. When does a corporation need a board of directors Who should and.pdf
1. When does a corporation need a board of directors Who should and.pdf
 
What is the difference between myeloid and lymphoid hemopoiesis.pdf
What is the difference between myeloid and lymphoid hemopoiesis.pdfWhat is the difference between myeloid and lymphoid hemopoiesis.pdf
What is the difference between myeloid and lymphoid hemopoiesis.pdf
 
Vascular graft You want to design a vascular graft. List some advant.pdf
Vascular graft  You want to design a vascular graft. List some advant.pdfVascular graft  You want to design a vascular graft. List some advant.pdf
Vascular graft You want to design a vascular graft. List some advant.pdf
 
West Nile Virus1. How is this diseasecondition transmitted (Be f.pdf
West Nile Virus1. How is this diseasecondition transmitted (Be f.pdfWest Nile Virus1. How is this diseasecondition transmitted (Be f.pdf
West Nile Virus1. How is this diseasecondition transmitted (Be f.pdf
 
Using the provided table interface table.h and the sample linked lis.pdf
Using the provided table interface table.h and the sample linked lis.pdfUsing the provided table interface table.h and the sample linked lis.pdf
Using the provided table interface table.h and the sample linked lis.pdf
 
The United Nations Security Council, the main decision-making body a.pdf
The United Nations Security Council, the main decision-making body a.pdfThe United Nations Security Council, the main decision-making body a.pdf
The United Nations Security Council, the main decision-making body a.pdf
 

Recently uploaded

How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 

Recently uploaded (20)

How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 

Write a program in c++ that produces a bar chart showing the populat.pdf

  • 1. Write a program in c++ 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 will take input from user for population figures (rounded to the nearest 1,000 people) for 1900, 1920, 1940, 1960, 1980, and 2000. For each year it should display the date and a bar consisting of one asterisk for each 1,000 people. Here is an example of how the chart might begin: PRAIRIEVILLE POPULATION GROWTH (each * represents 1,000 people) 1900 ** 1920 **** 1940 ***** After the bar chart, print out the maximum, minimum and average number of population. Solution #include using namespace std; int main() { int year[6]={1900,1920,1940,1960,1980,2000}; long population[6],calc[6]; int i,j; cout<<"Enter the population for years"; for(i=0;i<6;i++) { cin>>population[i]; //input years } cout << endl << "PRAIRIEVILLE POPULATION GROWTH"; cout << endl << "(each * represents 1,000 people) " << endl; for(i=0;i<6;i++)
  • 2. { calc[i]= population[i]/1000; //calcualte population per 1000 persons } for(i=0;i<6;i++) { cout << " "<