Ok...the program is supposed to read data from the file and then output one star for every 1000 people. At the bottom of the program, it is supposed to round the numbers up or down (2500 = 3 stars, 2499 = 2 stars) but I can't get that part to work. Please help! Thanks in advance.
int main()
{
int people;
ifstream inputFile;
inputFile.open("people.dat");
cout << "Reading information from the file.";
cout << endl;
if (!inputFile)
cout << "Error opening file." << endl;
else
{
for (int year = 1900; year < 2001; year += 20)
{
inputFile >> people;
cout << year << " " ;
for (int star = 0; star < people / 1000; star++)
cout << '*';
cout << endl;
}
while (people % 1000 < 500)
{
int star = 1;
cout << '*';
}
inputFile.close();
}
cout << endl;
system ("pause");
return 0;
}