I just reconstructed my new code and am having trouble. When I try to compile it I keep getting an error message. At the end of the program something is wrong, but I can't figure it out.
#include <iostream>
#include <cmath>
#include <string>
using namespace std;
int main ()
{
int weight;
string Planet;
char signal; //for when the program is prompted to terminate
{
do {
cout << "Please enter a weight between 0 to 1000 pounds rounded to the nearest whole number" << endl; //Prompts user to input valid weight
cin >> weight;
if (weight >= 0 && weight <= 1000) //Uses the condition that the weights have to be between 0 and 1000 to continue
{
cout << "Please enter a planet name from the following list." << endl;
cout << "Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, Neptune" << endl;
cout.precision(2)
if(Planet== "Mercury"){
cout << "The weight on Mercury is " << (weight*0.4155)<< endl;
}
else if(Planet== "Venus"){
cout << "The weight on Venus is " << (weight*0.8975)<< endl;
}
else if(Planet== "Earth"){
cout << "The weight on Earth is " << (weight*1.0)<< endl;
}
else if(Planet== "Mars"){
cout << "The weight on Mars is " << (weight*0.3507)<< endl;
}
else if(Planet== "Jupiter"){
cout << "The weight on Jupiter is " << (weight*2.5374)<< endl;
}
else if(Planet== "Saturn"){
cout << "The weight on Saturn is " << (weight*1.0677)<< endl;
}
else if(Planet== "Uranus"){
cout << "The weight on Uranus is " << (weight*0.8947)<< endl;
}
else if(Planet== "Neptune"){
cout << "The weight on Neptune is " << (weight*1.1794)<< endl;
else
{
cout << "Press c to input a new weight or q to terminate the program" << endl; //terminate or continue prompt
cin >> signal;
}
}
else if (weight <= 0 || weight >= 1000) //When user has not input a valid weight
cout << "Please enter in a weight between 0 and 1000" << endl;
} while (signal != 'q'); //Keeps repeating the program process until user inputs correct data until user presses 'q'
}
if (signal = 'q') // When q is pressed the program terminates
cout << "The program has ended, Have a nice day." << endl;
return 0;
}