[英]Error: unable to start program "*.exe" the system cannot find the file specified
[英]"+1 Overload --- Function definition for '...' not found" Along With "Unable to start program. The system cannot find the file specified"
这段代码是为作业而写的,我在作业中提示用户输入以根据患者是住院还是门诊以及用户输入的费率和费用来计算医院账单。 我遇到的问题是,当我尝试运行代码时,系统首先告诉我存在构建错误并询问我是否要继续。 继续后,我收到以下错误消息:
“无法启动程序。[文件路径]系统找不到指定的文件”
我正在检查我的代码,我唯一能看到的是主要 function 之前的 function 原型有一条消息,指出找不到 function 定义。
我的代码有问题还是这纯粹是 Visual Studio 2017 的问题? 我的目录看起来没有乱序之类的。
// PGM6 - Overloaded Hospital - 11.15.2020
#include "pch.h"
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
double inpatient(int days, double rateDaily, double chargesService, double chargesMeds, double chargesTotal);
double outpatient(double chargesService, double chargesMeds, double chargesTotal);
int main()
{
int patientType;
cout << "Please enter (1) for Inpatient or (2) for Outpatient" << endl;
cin >> patientType;
if (patientType == 1)
double inpatient();
else
if (patientType == 2)
double outpatient();
else
cout << "Please enter (1) or (2)." << endl;
}
double inpatient()
{
int days;
double rate;
double chargesService;
double chargesMeds;
double chargesTotal = (days * rate) + chargesService + chargesMeds;
cout << "Days: ";
cin >> days;
cout << endl;
cout << "Daily Rate: ";
cin >> rate;
cout << endl;
cout << "Service Charges: ";
cin >> chargesService;
cout << endl;
cout << "Medication Charges: ";
cin >> chargesMeds;
cout << endl << endl;
cout << "Total Charges: " << chargesTotal << endl;
return chargesTotal;
}
double outpatient()
{
double chargesService;
double chargesMeds;
double chargesTotal = chargesService + chargesMeds;
cout << "Service Charges: ";
cin >> chargesService;
cout << endl;
cout << "Medication Charges: ";
cin >> chargesMeds;
cout << endl << endl;
cout << "Total Charges: " << chargesTotal << endl;
return chargesTotal;
}
这是你做错了什么
我认为这段工作代码可以满足您的需求:
#include <iomanip>
#include <iostream>
#include <string>
using namespace std;
double inpatient();
double outpatient();
int main()
{
int patientType;
cout << "Please enter (1) for Inpatient or (2) for Outpatient" << endl;
cin >> patientType;
if(patientType == 1)
inpatient();
else if(patientType == 2)
outpatient();
else
cout << "Please enter (1) or (2)." << endl;
}
double inpatient()
{
int days;
double rate;
double chargesService;
double chargesMeds;
cout << "Days: ";
cin >> days;
cout << endl;
cout << "Daily Rate: ";
cin >> rate;
cout << endl;
cout << "Service Charges: ";
cin >> chargesService;
cout << endl;
cout << "Medication Charges: ";
cin >> chargesMeds;
cout << endl << endl;
double chargesTotal = (days * rate) + chargesService + chargesMeds;
cout << "Total Charges: " << chargesTotal << endl;
return chargesTotal;
}
double outpatient()
{
double chargesService;
double chargesMeds;
cout << "Service Charges: ";
cin >> chargesService;
cout << endl;
cout << "Medication Charges: ";
cin >> chargesMeds;
cout << endl << endl;
double chargesTotal = chargesService + chargesMeds;
cout << "Total Charges: " << chargesTotal << endl;
return chargesTotal;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.