double payCalc(double P,double yir, double y)
{
double mir, a, b, c, d, e, f, Payment;
mir = yir/1200;
a = 1+mir;
b = 1/a;`?`enter code here`
c = 12*y;
d = pow(b,c);
e = 1-d;
f = P*mir;":?
return Payment;
}
int main ()
{
cout<<fixed<<setprecision(2); //setting
double P, yir, y;
cin>>P>>yir>>y;
double payCalc(P, yir, y);
cout<<"Principal: "<<P<<" Interest Rate: "<<yir<<" Years: "<<y<<
" Payment: "<<payCalc<<endl;
}
计算房屋付款,无法摆脱上面的错误。 payCalc正在计算付款,而int main()将变量插入payCalc
答案 0 :(得分:0)
下面的代码行是一个声明,而不是函数调用
double payCalc(P, yir, y);
编译器认为您要声明类型为payCalc
的变量double
并将其初始化。由于您有一个表达式列表,而不是单个值或单个表达式,因此编译器会报错:
error: expression list treated as compound expression in initializer [-fpermissive]
如果要使用以下参数double
调用函数payCalc
,请删除P, yir, y
:
payCalc(P, yir, y);
注意:您发布的代码中包含流浪字符。