View the step-by-step solution to:

Question

C++ ///////////////////////////////////////////////////This is the code i have so far, it is

finished but giving me errors!

1. Error (active) E2140 expression must have integral or unscoped enum type...LINE 82
2. Error (active) E0299 cannot determine which instance of function template "std::endl" is intended... LINE 82

////////////////////////////////////////////////////////////////////////////////////

#include <iostream>

#include <iomanip>

#include <cmath>

#include <string>

using namespace std;

int main()

{

//define all variables

double aircraftEmoment = 2751405;

double aircraftFmoment = 1169167.3;

double aircraftweight = 9021;

double Fuelweight = 3168;

double dSeats = 120;

double dBay = 345;

double NumberMembers;

double CargoMoment;

int crewMoment, crewWeight1, crewWeight2, CenterGravity, Totalweight, TotalMoment;

double cargoweight = 0;

// choose if there are 1 or 2 crewmembers

cout << "Number of crewmembers, 1 or 2:" << endl;

cin >> NumberMembers;

// offer invalid entrys a retry, if valid proceed to members =1 or =2.... Either choice results in the same logical steps, with some variation in calculations

while (NumberMembers > 2 || NumberMembers < 1)

{

cout << "INVALID ENTRY, Enter Again: " << endl;

cin >> NumberMembers;

}

if (NumberMembers == 1) // if one do these calculations

{

cout << endl;

cout << " Weight of crewmember in pounds: " << endl;

cin >> crewWeight1;

while (crewWeight1 < 85 || crewWeight1 > 400)

{

cout << "INVALID ENTRY, Enter Again: " << endl;

cin >> crewWeight1;

}

cout << " CrewMember weight 1: " << crewWeight1 << "LB" << endl;

cout << setw(2) << "Cargo Weight (LB)" << setw(4) << "Center of Gravity (inches)";

cout << "=====================================================" << endl << endl;

while (cargoweight <= 5000.0)

{

Totalweight = crewWeight1 + cargoweight + Fuelweight + aircraftweight;

TotalMoment = aircraftEmoment + aircraftFmoment + (crewWeight1 * dSeats) + (cargoweight * dBay);

CenterGravity = TotalMoment / Totalweight;

if (CenterGravity >= 315)

{

cout << setprecision(1) << fixed << cargoweight << setprecision(3) << fixed << CenterGravity << endl;

}

else

{

cout << setprecision(1) << fixed << cargoweight << setprecision(3) << fixed << CenterGravity << endl;

}

cargoweight += 500;

}

}

else // if there are 2 do these calculations

{

cout << endl;

cout << " Weight of both crewmembers in pounds: " << endl;

cin >> crewWeight1, crewWeight2;

while (crewWeight1 < 85 || crewWeight2 < 85 || crewWeight1 > 400 || crewWeight2 > 400)

{

cout << "INVALID ENTRY, Enter Again: " << endl;

cin >> crewWeight1 >> crewWeight2;

}

cout << " CrewMember weight 1: " << crewWeight1 << "LB" << endl;

cout << " CrewMember weight 2: " << crewWeight2 << "LB" << endl;

cout << setw(2) << "Cargo Weight (LB)" << setw(4) << "Center of Gravity (inches)";

cout << "=====================================================" << endl << endl;

while (cargoweight <= 5000)

{

Totalweight = crewWeight1 + crewWeight2 + cargoweight + Fuelweight + aircraftweight << endl;// 2 Errors

TotalMoment = (crewWeight1 * dSeats) + (crewWeight2 * dSeats) + aircraftEmoment + aircraftFmoment + (cargoweight * dBay);

CenterGravity = TotalMoment / Totalweight;

if (CenterGravity >= 315)

{

cout << setprecision(10) << fixed << cargoweight << setprecision(3) << fixed << CenterGravity << endl;

}

else

{

cout << setprecision(10) << fixed << cargoweight << setprecision(3) << fixed << CenterGravity << endl;

}

cargoweight += 500;

}

}

system("pause");

return 0;

}

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
• -

Study Documents

Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

Browse Documents