# Weight Calculator on Different Planets using C++

By Srishti Dhaval Patkar

This is a C++ programme to calculate your weight on different planets and also your weight on unknown planets or heavenly bodies if you enter their radius and mass.

## void get_mass():

This function takes your weight on the weighing machine as an input and calculates your mass by dividing it by 9.8 (acceleration due to gravity of earth)

void get_mass() //for inputing the mass
{
cout<<"What's your weight on weighing machine? ";
cin>>machine_weight;
mass=machine_weight/9.8;//dividing weighing machine weight by acceleration due to gravity (g) on earth
}

## void moon():

This function calculates your weight on the moon by multiplying your mass with g of the moon.

void moon()
{
planet_weight=mass*1.6; // g(moon)=1.6
cout<<"Your weight on Moon is "<<planet_weight<<endl;
}

Similarly, your weights on other planets are calculated by multiplying your mass with their respective g's.

## void unknown_planet():

This function finds your weight on a planet whose radius and mass is entered by you with the help of a formula.

void unknown_planet()//to calculate weight on unknown planet using planet's mass and radius
{
cout<<"Enter Radius of the planet";
cin>>radius;
cout<<"Enter Mass of the planet";
cin>>mass_of_planet;
planet_weight=((G*mass_of_planet*mass)/(radius*radius));
}

## Comments