Program Modification

Hey guys, I need some help with a program Im writing for class. The program below calculates the amount of uncut acrea being reforested per year for a total of 20 years at a rate of 0.02% per year.

I need to modify the program so that the user can enter the total number acres
and the number of uncut acres. The reforestation rate will remain fixed at 0.02.
The program will display the initial parameters, e.g, total number of acres,
number of uncut acres, and the reforestation rate. The program will then compute and display the number of years it will take until the number of acres cut will be completely renewed.

Any help would be greatly appreciated.

#include <stdio.h>
#include <stdlib.h>
#include <iostream>

using namespace std;


int main()
{
int years = 0;
double temp=0;
double total;

printf("Please Enter the number of uncut acres: ");
cin >> total;

while(years<20)
{
temp = .02*total;
total+= .02*total;
years++;
cout << "Year " << years << ": total: " << total << " increased by: " << temp << "\n";

}
//printf("total number of acres is %d \n", total);
}
Last edited on
Are you getting any errors or anything?

What problems are you having, specifically?
closed account (jwC5fSEw)
Why are you mixing stdio and iostream like that? Is there any specific reason?
Topic archived. No new replies allowed.