CODE : //Declare and initialize objects
double initial, increment, final, time, height, velocity, max_time(0), max_height(0);
int loops;
//Get user inputs
cout << "Enter initial value for table (in hours) \n";
cin >> initial;
cout << "Enter increment between lines in hours \n";
cin >> increment;
cout << "Enter final time (in hours) \n";
cin >> final;
// set formats
cout.setf(ios::fixed);
cout.precision(2);
//Number of loops will be calculated
loops=(int)( (final - initial)/increment );
for (int count= 0; count<=loops; ++count);
{
time=initial+count*increment;
height=-0.12*pow(time,4)+12*pow(time,3)-380*pow(time,2)+4100*time+220;
velocity=-0.48*pow(time,3)+36*pow(time,2)-760*time+4100;
cout<<setw(6)<<time<<setw(10)<<height<<setw(14)<<velocity/3600<<endl;
if (height>max_height)
{
max_height=height;
max_time=time;
}
}
cout<<"\n Maximum balloon height was"<<setw(8)<<max_height<<"meters \n";
cout<<"and it happened at this time"<<setw(6)<<max_time<<"hours \n";
return 0;
}
You're not showing your whole code. The problem here isn't shown in what you posted. The compiler says that there's something wrong with count on the 42nd line of your code.
Undeclared identifier would mean that it thinks count is supposed to be a variable, but you haven't declared it. You probably did a typo there and meant to use cout instead.