Hi y'all!
I'm kinda new to c++ so please excuse my inefficiencies.
Anyways, here is the assignment:
Write a C++ program to estimate the springtime count of deer in a park for 10 consecutive years. The population of any given year depends on the previous year's population according to the following calculation:
If the lowest winter temperature was 0 degrees F or colder, the deer population drops by 12%.
If the lowest winter temperature was higher than 0 degrees F, the deer population rises by 15%.
And here is my code:
#include <iostream>
#include <stdlib.h>
#include <string>
using namespace std;
int main()
{
int year;
int pop1;
int pop2;
int temp;
cout<<"Please enter the starting year."<<endl;
cin>>year;
cout<<"Please enter the starting population for the deer."<<endl;
cin>>pop1;
cout<<"What was the lowest winter temperature in "<<year<<endl;
cin>>temp;
if (temp < 0)
pop2 = pop1 - (pop1 * 0.12);
cout<<"In "<<year", the deer population is "<<pop2<<endl;
else if (temp = 0)
pop2 = pop1 - (pop1 * 0.12);
cout<<"In "<<year", the deer population is "<<pop2<<endl;
else
return 0;
cout<<"In "<<year", the deer population is "<<pop2<<endl;
if (temp > 0)
pop2 = pop1 + (pop1 * 0.15);
cout<<"In "<<year", the deer population is "<<pop2<<endl;
else
return 0;
cout<<"In "<<year", the deer population is "<<pop2<<endl;
system ("PAUSE");
return 0;
}
And this is my dilemma:
1. The "system("pause")" doesn't work.
2. I get an error message when I compile.
Somebody PLEASE help me, this thing is driving me crazy!!
Thanks in advance.
~xoxo