Please make sure it works Ive been struggling with this and
Solution
#include <cstdlib>
#include <iostream>
using namespace std;
void fuel(float & dist);
void distance(float dist, float & time, float & time2 );
void Altitude(float time, float time2, float altlevel);
void Climb_Descend(float altlevel);
int main(int argc, char *argv[])
{
float altlevel;
float dist;
int fuelcon;
float speed=300, altspeed;
char choice;
bool OK;
do
{
fuel(dist); //calls
distance(dist, speed, altspeed);
Altitude(speed, altspeed, altlevel);
Climb_Descend (altlevel);
cout <<\"do you want to calaculate again?\"<<endl;
cout<<\"enter Y or N\"<<endl;
cin>>choice;
if(choice==\'Y\' || choice==\'y\')
{
OK=true;
}
else
OK=false;
}
while (OK==true);
system(\"PAUSE\");
return EXIT_SUCCESS;
}
void fuel (float & dist) //function
{
cout<<\"Enter the distance of flight \"<<endl;
cin>>dist;
}
void distance(float dist, float & time, float & time2)
{
time = dist/300; // Speed is constant 300mph
time2 = (time - 0.30)*60; //30 minutes is needed to get to the top level
cout<< \" the flight will last \"<<time<<\" hours \"<<endl; // output
}
void Altitude(float time, float time2, float altlevel) //function
{
float Level1,Level2,Level3,Level4,Level5,Level6,Level7,Level8,Level9; // each level goes from 0 to 40,000 feet,
float climb, descend, topFly;
int min;
min = 10;
Level1 = 12,5 * min;
Level2 = 11,33 * min;
Level3 = 10,25 * min;
Level4 = 9.08 * min;
Level5 = 7.91 * min;
Level6 = 6,83 * min;
Level7 = 5,66 * min;
Level8 = 4,5 * min;
Level9 = 3,33;
climb = (Level1 + Level2 + Level3 + Level4 + Level5 + Level6 + Level7 + Level8) * 1.4;
topFly = Level9*time2;
descend = (Level1 + Level2 + Level3 + Level4 + Level5 + Level6 + Level7 + Level8 ) * 0.9;
altlevel = climb + descend + topFly;
}
void Climb_Descend (float altlevel ) {
cout <<altlevel;
}

