Wywołanie funkcji w głównym
Właśnie się uczęC ++ i mam tu mały kod:
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;
}
Kompiluje się, ale gdy go uruchomię, drukuje tylko:
This program will calculate the weight of any mass on the moon
ale nie wykonujemoon_g
funkcjonować.