for some reason this keeps coming up as "ambiguous call to overloaded function" Can anyone tell me why?
Three answers:
2009-02-24 09:30:13 UTC
Hey there could be a few different problems with your function but it's not in that code snippet.
Are you trying to use an overloaded function? If not then you just have to change the functions name.
If you are then chances are you have to tell the compiler which function to use. For example...
void function(double input)
void function(int input)
input = 5
function(input)
This is where the ambiguous error comes from because it doesn't know which function to use. You can fix this by casting it in your function call.
function((double)input)
Soma L
2009-02-24 09:33:05 UTC
ambiguous call to overloaded function error will arise when you use the inbuilt function with different arguments.
for example
double exp(double) is inbuilt function and if you use the same function name with different arguments you will get an error.
golightly
2016-10-25 18:19:17 UTC
You do have a pair of obvious mistakes. Your patientCharges both fail to multiply the each day price by using # days in clinical institution Your problem (enter != 'I' && enter != 'O') is incorrect: should be OR || also you should offer up over operating the important approach by using growing to be added worker techniques outside, alongside with the alternative affected human being makes about being In or Out-affected human being. it ought to also be wise to apply a change for your 'I' or 'O' problem for some cleanser processing. proper the following demonstrates the corrections and what i'm speaking about. Please word that's not an finished software --- you nevertheless have some activities for your project, alongside with ideal shifting into the quantities owing and combating the person shifting into -a million and so on. #contain iostream #contain iomanip utilising namespace std; // declare approach scopes for use later in code char selection(); double patientCharges(int, double, double, double); double patientCharges(double, double); int important() { char enter; double price, med, serv; int days; cout << "enter affected human being form (I or O):r "; enter = selection(); change (enter) { case 'I' : cout << "Please enter days admitted:r "; cin >> days; cout << "Please enter each day price:r "; cin >> price; cout << "Please enter clinical expenditures:r "; cin >> med; cout << "Please enter service expenditures:r "; cin >> serv; cout << patientCharges(days, price, med, serv); ruin; case 'O' : cout << "Please enter clinical expenditures:r "; cin >> med; cout << "Please enter service expenditures:r "; cin >> serv; cout << patientCharges(med, serv); ruin; } go back 0; } // worker techniques double patientCharges(int days, double price, double med, double serv) { go back (days * price) + med + serv; } double patientCharges(double med, double serv) { go back med + serv; } char selection() { char c; cin >> c; at the same time as (c != 'I' || c != 'O') { cout << "Invalid selection, attempt againnn"; cout << "enter affected human being form:"; cin >> c; } go back c; }
ⓘ
This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.