Help with code

I am 90% done with the code I just can't seem to get the coding right for the output. The code needs to be showing the forested acres at the end of each year but right now it is only showing one year. Any suggestions on what I'm doing wrong?


#include<iostream>
using namespace std;

int main()

{


// Programmers name and assignment number
cout << "--------------------------------------------" << endl;
cout << "Project 1" << endl;
cout << "--------------------------------------------" << endl;

// Declare and initialize object
float reforest, uncut, years = 0, forested;


cout << " PLEASE PROVIDE THE PARAMETERS" << endl;


// Input parameters
cout << "\nANTICIPATED REFORESTATION RATE: ";
cin >> reforest;
while ((reforest< 0.002) || (reforest > 0.5))
{
cout << "WARNING REFORESTATION RATE MUST BE BETWEEN 0.002 AND 0.5" << endl;
cout << "PLEASE REENTER REFORESTATION RATE : ";
cin >> reforest;

}

cout << "UNCUT ACES OF THE FOREST: ";
cin >> uncut;
while (uncut < 10)
{
cout << "WARNING UNCUT ACRES MUST BE MORE THAN 9 ACR" << endl;
cout << "PLEASE REENTER UNCUT ACRES OF THE FOREST :";
cin >> uncut;

}


cout << "TOTAL YEARS OF THE FOREST FOR REFORESTATION: ";
cin >> years;
while (years < 5)
{
cout << "Warning! DURATION MUCT BE MORE THAN 5 YEARS" << endl;
cout << " PLEASE REENTER TOTAL YEARS ALLOCATED FOR REFORESTATION: ";
cin >> years;
}

for (double i = 1; i<years + 1; ++i)
{
forested = (uncut + (reforest * uncut)*i);
}

cout << "\nYEARS FORESTED ACRES AT END OF YEAR" << endl;
cout << "-------------------------------------------" << endl;

cout << years << "\t" << uncut << endl;
years++;



// Exit display
cout << "------------------------------------" << endl;
cout << "End of Project #1" << endl;
cout << "------------------------------------" << endl;


// Exit program
system("pause");
return 0;

}
put the print statement in here

for (double i = 1; i<years + 1; ++i)
{
forested = (uncut + (reforest * uncut)*i);
cout <<"words " << forested << "morewords!" << endl;
}

to print "forested" after each year.
Last edited on
Topic archived. No new replies allowed.