+ 3
there are 9000 in a town whose population increases by 15%each yr. write a program that displays the annual population and determines the no. of yrs it will take for the population to surpass 50000
2 Respostas
+ 5
int population, p = 9000;
float increase, inc = .15;
int overpopulation, op = 50000;
int year = 1;
cout << "year: 0" << " pop: " << p << endl;
for (p; p <= op; ++year){
p += p*inc;
cout << "year: " << year << " pop: " << p << endl;
}
best i could do.
0
please help me understand, why use ++year, and not year ++?