无法调用C ++函数

1 c++

我尝试调用的函数无法调用。虽然当我删除数据类型时会调用它们,但是当我尝试放入数据类型时却无法正常工作。编译但显示空白屏幕

还没有尝试过任何东西,因为这是我第一次遇到

功能1

double computeGrossPay(int hoursWorked, int perHourRate){
    double grossPay = hoursWorked * perHourRate;
    cout << "This is the computed Gross Pay"<<grossPay<<endl;
    return grossPay;
}

int main (){
    double computeGrossPay(int hoursWorked, int perHourRate);
}
Run Code Online (Sandbox Code Playgroud)

没有错误但没有结果(空白CMD)

Jab*_*cky 5

double computeGrossPay(int hoursWorked, int perHourRate); 不调用函数,它只是声明它。

您可能想要类似:

int main (){

  double myresult = computeGrossPay(10, 20);
  // do something with myresult...
}
Run Code Online (Sandbox Code Playgroud)

顺便说一句,double如果函数的两个参数均为ints ,则具有结果类型毫无意义。我让你找出为什么做运动。