Can someone please help me get started on these problems? I have been looking through my book and i cannot seem to get anything going. Also, my compiler is telling me 'exp' is an invalid floating constant. I am trying to use 'exp' for 'e' but it is not letting me. Here are the problems i am having issues with:
1.) Using this formula, population=6.0e0.02[year-2000], write, compile, and run a C++ program to estimate the worldwide population in the year 2012. Verify the result of your program produces by calculation the answer manually. After verifying that your program is working correctly, use it to estimate the world's population in the years 2019 and 2025.
2.)Using this formula, remaining material = (original material)e-0.00012t, write, compile, and run a C++ program to determine the amount of radioactive material remaining after 1000 years, assuming an initial amount of 100 grams. Determine the amount of radioactive material remaining after 275 years, assuming an initial amount of 250 grams.
3.) The number of years it takes for an isotope of uranium to decay to one-half an original amount is given by this formula, where λ,, the decay constant (which is equal to the inverse of the mean lifetime), equals 0.00012:
half-life=ln(2)/λ
Using this formula, write, compile, and run a C++ program that calculates and displays the half-life of this uranium isotope. Determine the half-life of a uranium isotope with λ=0.00026.
It would be a huge help if someone could help me get started. Please and thank you!
int main()
{
double pop, year_1;
ofstream output ("C:result.dat");
while (year_1 == 2012)
{
pop=6.0exp(0.02(year_1-2000));
cout<<"enter year 2012: ";
cin>> year_1;
}
cout<<"\nThe estimated population in 2019 is "<<pop<<endl;
I am just as confused as you are. What I typed above is all the information I know. I know for question one I am trying to find the estimated population in years 2012, 2019, and 2025.
More specifically for the program i started above, the only error it says i have is the exp being an invalid floating constant, which makes no sense to me because i was told by my professor to use 'exp' for 'e'
Well you should probably initialize them, then, shouldn't you? (Give them a value before you use them, even if it's 0. Until you give them a value they are just garbage numbers.)
int main()
{
double pop,year_1;
ofstream output ("C:result.dat");
year_1= 2012;
// Problem 10
{
pop=6.0*exp(0.02*(year_1-2000));
cout<<"enter year 2012: ";
cin>> year_1;
}
cout<<"The estimated population (in billions) in year 2012 is "<<pop<<endl;