这些功能的目标最终是显示某人的咨询总费用,这取决于他们是否有低收入。假设函数向下流动以获得每个所需的值以便计算总数。我不明白如何修复我的代码中的各种错误,例如某些变量未在特定范围内声明,即使我认为我已正确声明它们。
#include <iostream>
using namespace std;
const double HighIncomeRate = .7;
const double LowIncomeRate = .4;
bool isLowIncome();
int main() {
double Fee;
double ConsultTime;
cout << "Your fee is: " << getcalcFee(consultTime, Income) << endl;
return 0;
}
bool isLowIncome() {
double Income;
cout << "What is your income: " << endl;
cin >> Income;
cout << "How long have you been consulted" << endl;
cin >> ConsultTime;
if (Income <= 25000) {
return true;
} else {
return false;
}
}
double calcFee(int &ConsultTime, const double HighIncomeRate,
const double LowIncomeRate) {
if (isLowIncome == true) {
if (ConsultTime <= 30) {
calcFee = 0
} else {
calcFee = LowIncomeRate * 50((ConsultTime - 30) / 60)
}
}
if {
if (ConsultTime <= 20) {
calcFee = 0
} else {
calcFee = HighLowRate * 50((ConsultTime - 20) / 60)
}
}
return 0;
}