Aufruf einer Funktion in main

Ich bin nur zu lernen C++ und ich habe einen kleinen code hier:

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;
}

Kompiliert, aber wenn ich es es nur druckt:

This program will calculate the weight of any mass on the moon

aber nicht ausführen moon_g Funktion.

mögliche Duplikate von The Definitive C++ Book Guide and List
ich danke Ihnen allen für Ihre Hilfe!
also, der einzige Weg, um eine Funktion aufzurufen, die in c++ von der main-Funktion wird mit cout<<bestimmte Funktion?
Nein, natürlich nicht. Die Antwort zeigt, dass. Welches Buch benutzt du? Haben Sie Lesen Sie es noch?

InformationsquelleAutor user3150381 | 2014-01-04

Schreibe einen Kommentar