1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
#include <cctype>
#include <iostream>
#include <cmath>
using namespace std;
double weight;
double planet_weight;
string planet;
double weightonplanet = 0;
enum planet_names{Mercury,Venus,Earth,Moon,Mars,Jupiter,Saturn,Uranus,Neptune,Pluto};
planet_names findweight(string str);
int main()
{
cout << "********************************************************************" << endl;
cout << endl;
cout << "Enter the name of a planet from the following options:" << endl;
cout << "(Mercury,Venus,Earth,Moon, Mars,Jupiter,Saturn,Uranus,Neptune,Pluto)" << endl;
cout << endl;
cout << "********************************************************************" << endl;
cin >> planet;
cout << endl;
cout << endl;
cout << "Please enter your current weight (ex:205)" << endl;
cin >> weight;
cout << endl;
cout << "You have entered " << planet << "." << endl;
cout << "You currently weigh " << weight << "lbs." << endl;
cout << "Your weigh on " << planet << "is " << weightonplanet << " ." << endl;
while (true)
{
switch (string planet);
{
case Mercury:
weightonplanet = weight * 0.4155;
break;
case Venus:
weightonplanet = weight * 0.8975;
break;
case Earth:
weightonplanet = weight * 1.0;
break;
case Moon:
weightonplanet = weight * 0.166;
break;
case Mars:
weightonplanet = weight * 0.3507;
break;
case Jupiter:
weightonplanet = weight * 2.5374;
break;
case Saturn:
weightonplanet = weight * 1.0677;
break;
case Uranus:
weightonplanet = weight * 0.8947;
break;
case Neptune:
weightonplanet = weight * 1.1794;
break;
case Pluto :
weightonplanet = weight * 0.899;
break;
}
}
return weightonplanet;
|