#include <iostream>
using namespace std;
int main( ) {
float startingNum;
int numOfDays;
float dailyRate;
float dailyPct;
float increaseAmt;
cout << "Enter the starting number of poplation\n " ;
cin >> startingNum;
while ( startingNum < 2 )
{
cout << "Only enter number that is 2 or more.\n " ;
cin >> startingNum;
}
cout << "Enter the daily rate for the multiplication. Write 10 if its 10%.\n " ;
cin >> dailyRate;
while ( dailyRate < 0 )
{
cout << "Only enter postive number\n " ;
cin >> dailyRate;
}
cout << "Enter the number of days\n " ;
cin >> numOfDays;
while ( numOfDays < 1 )
{
cout << "Only enter number 1 or that is greater than 1.\n " ;
cin >> numOfDays;
}
dailyPct = dailyRate/ 100 ;
cout << "Size of population for day 1 :" << startingNum << endl;
for ( int i = 2 ; i <= numOfDays ; i++ )
{
increaseAmt = dailyPct * startingNum;
startingNum + = increaseAmt;
cout << "Size of population for day " << i << " :" ;
cout << startingNum << endl;
}
return 0 ;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CglmbG9hdCBzdGFydGluZ051bTsKCWludCBudW1PZkRheXM7CglmbG9hdCBkYWlseVJhdGU7CglmbG9hdCBkYWlseVBjdDsKCWZsb2F0IGluY3JlYXNlQW10OwoJCgljb3V0IDw8ICJFbnRlciB0aGUgc3RhcnRpbmcgbnVtYmVyIG9mIHBvcGxhdGlvblxuIjsKCWNpbiA+PiBzdGFydGluZ051bTsKCQoJd2hpbGUgKHN0YXJ0aW5nTnVtIDwgMikKCXsKCQljb3V0IDw8ICJPbmx5IGVudGVyIG51bWJlciB0aGF0IGlzIDIgb3IgbW9yZS5cbiI7CgkJY2luID4+IHN0YXJ0aW5nTnVtOwoJfQoJCgljb3V0IDw8ICJFbnRlciB0aGUgZGFpbHkgcmF0ZSBmb3IgdGhlIG11bHRpcGxpY2F0aW9uLiBXcml0ZSAxMCBpZiBpdHMgMTAlLlxuIjsKCWNpbiA+PiBkYWlseVJhdGU7CgkKCXdoaWxlICh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