I've tried tweaking it to the best of my knowledge and it still keeps printing out the same input value for "deerpop" no matter what I've done. It never executes this line 31 deerpop = (deerpop) - ((deerpop) * (12/100));or line 36, under both if statements. Any advice would be appreciated.
#include <iostream>
#include <stdlib.h>
#include <string>
usingnamespace std;
int main()
{
int index = 0;
int year;
int deerpop;
int wintertemp;
cout<<"type in initial year."<<endl;
cin>>year;
//
cout<<"type in the animal population for "<<year<<" . "<<endl;
cin>>deerpop;
while (index < 10)
{
year = year + 1;
cout<<"Enter lowest temperature for "<<year<<"? "<<endl;
cin>>wintertemp;
//If the low temperature was 0 degrees or lower, the animal pop. decreases by twelve percent
if (wintertemp <= 0)
{
deerpop = (deerpop) - ((deerpop) * (12/100));
cout<<"In "<<year<< " the deer population was "<<deerpop<< " ."<<endl;
}
//if temperature was higher than zero the pop. increases by fifteen ppercent
if (wintertemp > 0)
{
deerpop = (deerpop) + ((deerpop) * (15/100));
cout<<"In "<<year<< " the deer population was "<<deerpop<< " ."<<endl;
}
index = index + 1;
}
system ("PAUSE");
return 0;
}