#include <iostream>
#include <iomanip>
using namespace std;
double addcharges(int, double);
double addcharges(double);
int main()
{
int inout, days;
double charges, rate, medcharges;
cout<<"***********************************************\n";
cout<<"* Press the either number and press enter *\n";
cout<<"* 1. In-patient 2. Out-patient *\n";
cout<<"***********************************************\n";
cin>>inout;
if ( inout < 1 || inout > 2)
{
cout<<"You did not input a 1 or a 2. Reenter number: \n";
cin>>inout;
}
switch(inout)
{
case 1:
{
cout<<"Enter the number of days spent in the hospital. \n";
cin>>days;
cout<<"Enter the daily rate. \n";
cin>>rate;
cout<<"Enter charges for hospital services. \n";
cin>>charges;
cout<<"Enter hospital medication charges. \n";
cin>>medcharges;
cout<<"Total hospital charges.................."<<addcharges(rate, days, charges, medcharges)<<endl;
}
case 2:
{
cout<<"Enter charges for hospital services. \n";
cin>>charges;
cout<<"Enter hospital medication charges. \n";
cin>>medcharges;
cout<<"Total hospital charges.................."<<addcharges(charges, medcharges)<<endl;
}
return 0;
}
double addcharges (double rate, int days, double charges, double medcharges)
{
return (rate * days) + charges + medcharges;
}
double addcharges (double charges, double medcharges)
{
return charges + medcharges;
}
}
The errors are...
error C2661: 'addcharges' : no overloaded function takes 4 parameters error C2601: 'addcharges' : local function definitions are illegal error C2601: 'addcharges' : local function definitions are illegal
any help is greatly appreciated!

New Topic/Question
Reply



MultiQuote



|