C++ 无法调用函数

C++ Functions can't be called

本文关键字:函数 调用 C++      更新时间:2023-10-16

我尝试调用的函数无法调用。虽然当我删除数据类型时,它们被调用,但当我尝试输入数据类型时,它不起作用。它编译但显示空白屏幕

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

职能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);
}

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

double computeGrossPay(int hoursWorked, int perHourRate);

不调用函数,它只是声明它。

您可能想要类似以下内容:

int main (){
double myresult = computeGrossPay(10, 20);
// do something with myresult...
}

顺便说一下,如果函数的两个参数都ints,则double结果类型毫无意义。我让你找出为什么作为练习。