Plzzzzzzzzzzzz Help program that produces a bar chart showing the population growth of Prairieville, a small?

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 (rounded to the nearest 1000 people) for 1900, 1920, 1940, 1960, 1980, and 2000 from a file. For each year it should display the date and a bar consisting of 1 asterisk for each 1000 people. The data can be found in the people.txt file.

Here is an example of how the chart might begin:

PRAIRIEVILLE POPULATION GROWTH
(each * represents 1000 people)

1900 *
1920 **
1940 *****

data inside people.txt is
2017
4416
4986
7129
7625
9243

Plz help me any kind soul with this program written only in C++ . I have spent couple of hours to understand the problem but sorry could not figure this out. Thanx in advance but plz in C++ very simple basic program without arrays and no pointers. thanx

Certainly! I can help you with that. Here's a simple C++ program that reads the population figures from a given file and produces a bar chart showing the population growth for the given years:

```cpp
#include <iostream>
#include <fstream>

using namespace std;

int main() {
ifstream file("people.txt");
if (!file.is_open()) {
cout << "Failed to open the file.\n";
return 1;
}

cout << "PRAIRIEVILLE POPULATION GROWTH\n(each * represents 1000 people)\n\n";

int year = 1900;
int population;
int asterisks;

while (file >> population) {
asterisks = population / 1000;

cout << year << " ";
for (int i = 0; i < asterisks; i++) {
cout << "*";
}
cout << "\n";

// Increment year by 20 for the next iteration
year += 20;
}

file.close();
return 0;
}
```

Explanation:
1. We include the necessary header files `iostream` and `fstream`.
2. We use the `ifstream` object to open the file `people.txt` in which the population figures are stored.
3. We check if the file was opened successfully. If not, we display an error message and exit the program.
4. We display the header for the bar chart.
5. We declare variables `year` for the current year and `population` to store the population figure read from the file.
6. We enter a loop that continues until we have read all the population figures from the file.
7. Within the loop, we calculate the number of asterisks needed to represent the population (by dividing the population by 1000).
8. We display the year and a corresponding number of asterisks using a `for` loop.
9. Finally, we increment the year by 20 to move on to the next interval.
10. After the loop, we close the file and return 0 to indicate successful execution of the program.

Make sure that the `people.txt` file is located in the same directory as your program file. Each population figure should be on a separate line in the file.

I hope this helps! Let me know if you have any further questions.