C++ Function Definition Calculate the user's weight in a second function

Description

C++ Function Definition Calculate the user's weight in a second function

#include <iostream>
using namespace std;
moon(int earth_weight);
int main()//from  ww w . j  a v a  2 s . co m
{
   int weight;    
   cout << "How many pounds do you weigh? ";
   cin >> weight;
   moon(weight);  
   return 0;      
}
moon(int earth_weight)
{
   int moon_weight;   
   // Moon's weights are 1/6th of earth's weights.
   moon_weight = earth_weight / 6;
   cout << "You only weigh " << moon_weight << " pounds on the moon!";
   return 0;                      
}



PreviousNext

Related