1) if (selection >= 'a' && selection <= 'h')
The user could have caps lock pressed, so consider A~Z also
2) (in my opinion) Quit should be at the start of logic.
3) You can use switch(selection) instead. dafault: Invalid Input. Try again.
4) Put your output in a function and pass the variables to it, instead of writting the same code over again
void prn(float sgrav, int pweight, char arr[], float distance, float travel)
{
cout << "INTERPLANETARY TRAVEL: " << "Earth to " << planet << endl
<< "--------------------------------------------------" << endl
<< "Your weight on " << planet << ": " << setprecision(2) << pweight << " lbs" << endl
<< endl
<< "Your travel time to " << planet << ":" << endl
<< " In Hours: " << travel << " hours" << endl
<< " In Days : " << (travel / 24) << " days" << endl
<< " In years : " << (travel / 8760) << " years" << endl;
}
solved Syntax error, also would like to know if i can make this code more efficient