Nov 21, 2013 at 2:28am UTC
Hello, I'm currently working on a program that calculates the center of gravity of an aircraft and the program must be able to save the successful calculations which means lets say the output says "the aircraft is safe to fly" by using that output it will save the calculations that got the output in the first place for future uses. which means even if terminate the program and open it again, i can view the history of my successful calculations.
#include <iostream>;
#include <string>;
using namespace std;
int main()
{
const int Maximum_Weight = 2500;
double Total_Weight;
double Total_Moment;
double c_o_g;
double AC_Basic = 1579;
const double ARM_AC_Basic = 3.5;
double Weight_of_CoPilot;
const double ARM_Weight_of_CoPilot = 3.55;
double Paxs;
const double ARM_Paxs = 2.54;
double Cargo;
const double ARM_Cargo = 3.20;
double Fuel_Front;
const double ARM_Fuel_Front = 3.24;
double Fuel_Rear;
const double ARM_Fuel_Rear = 3.85;
double Float_Bags;
const double ARM_Float_Bags = 3.365;
double Float_Bolts;
const double ARM_Float_Bolts = 3.365;
double Hoist;
const double ARM_Hoist = 2.726;
double Lift_Aft;
const double ARM_Lift_Aft = 2.54;
double Emerge_Pack;
const double ARM_Emerge_Pack = 2.54;
double ATOW;
const double ARM_ATOW = 3.26;
char re_enter;
cout<<" WELCOME\n Please insert weight (KG) for each items\n Weight must not exceed 2500 Kg\n\n";
do {
cout<<" \n Pilot and Co Pilot : ";
cin>> Weight_of_CoPilot;
cout<<" Paxs : ";
cin>> Paxs;
cout<<" Cargo : ";
cin>> Cargo;
cout<<" Fuel Front : ";
cin>> Fuel_Front;
cout<<" Fuel Rear : ";
cin>> Fuel_Rear;
cout<<" Float_Bags : ";
cin>> Float_Bags;
cout<<" Float_Bolts: ";
cin>> Float_Bolts;
cout<<" Hoist : ";
cin>> Hoist;
cout<<" Lift Aft : ";
cin>> Lift_Aft;
cout<<" Emerge Pack : ";
cin>> Emerge_Pack;
cout<<" ATOW : ";
cin>> ATOW;
Total_Weight =
+ AC_Basic
+ Weight_of_CoPilot
+ Paxs
+ Cargo
+ Fuel_Front
+ Fuel_Rear
+ Float_Bags
+ Float_Bolts
+ Hoist
+ Lift_Aft
+ Emerge_Pack
+ ATOW;
cout<<"\n Total amount of weight is "<< Total_Weight << " Kg \n";
if (Total_Weight >= 2500)
{
cout << " The weight have exceed 2500 Kg\n Please re-enter weight (y/n) 'y' to re-enter, 'n' to exit ";
cin >> re_enter;
break;
}
else
{
break;
}
} while ( re_enter == 'y');
Total_Moment =
+ (AC_Basic * ARM_AC_Basic )
+ (Weight_of_CoPilot * ARM_Weight_of_CoPilot)
+ (Paxs * ARM_Paxs)
+ (Cargo * ARM_Cargo)
+ (Fuel_Front * ARM_Fuel_Front)
+ (Fuel_Rear * ARM_Fuel_Rear)
+ (Float_Bags * ARM_Float_Bags)
+ (Float_Bolts * ARM_Float_Bolts)
+ (Hoist * ARM_Hoist)
+ (Lift_Aft * ARM_Lift_Aft)
+ (Emerge_Pack * ARM_Emerge_Pack)
+ (ATOW * ARM_ATOW);
cout<<" Total amount of moment is " << Total_Moment <<" KgM \n\n";
c_o_g = Total_Moment / Total_Weight;
cout <<" Centre of Gravity is : "<< c_o_g;
if (c_o_g >= 3.25 && c_o_g <= 3.45)
{
cout<<"\n Aircraft is safe to fly \n";
}
else
{
cout<<"\n Aircraft is NOT safe to fly \n";
}
return 0;
}