Llamando una función en main
Yo sólo estoy aprendiendoC ++ y tengo un pequeño código aquí:
using namespace std;
int main()
{
cout<<"This program will calculate the weight of any mass on the moon\n";
double moon_g();
}
double moon_g (double a, double b)
{
cout<<"Enter the mass in kilograms. Use decimal point for any number entered";
cin>>a;
b=(17*9.8)/100;
double mg=a*b;
return mg;
}
Se compila, pero cuando lo ejecuto solo se imprime:
This program will calculate the weight of any mass on the moon
pero no ejecuta elmoon_g
función.