Here is what I have so far: #include <iostream> #include <fstream> using namespa
ID: 3532815 • Letter: H
Question
Here is what I have so far:
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream inputFile;
int population;
cout << "Prairieville Population Growth ";
cout << "(each * represents 1,000 people) ";
inputFile.open("C:\Users\anthony\Desktop\Programming\People.txt");
inputFile >> population;
cout << "1900 ";
while (population / 1000)
{
cout << " * ";
cout << endl;
break;
}
inputFile >> population;
cout << "1920 ";
while (population / 1000)
{
cout << " * " << endl;
break;
}
inputFile >> population;
cout << "1940 ";
while (population / 1000)
{
cout << " * " << endl;
break;
}
inputFile >> population;
cout << "1960 ";
while (population / 1000)
{
cout << " * " << endl;
break;
}
inputFile >> population;
cout << "1980 ";
while (population / 1000)
{
cout << " * " << endl;
break;
}
inputFile >> population;
cout << "2000 ";
while (population / 1000)
{
cout << " * " << endl;
break;
}
inputFile.close();
system("PAUSE");
return 0;
}
My while statement isn't working any help will be appreciated. Thank you
Explanation / Answer
eliminate break statement and set population=population-1000 in each while