Error on Xcode "No matching function for call to 'max'"
c++, compiler-errors, xcode
Solution
`max()` requires that the first and second arguments are of the same type. extra_charge is a double which results in the first and second arguments having different type. Try:
max((used_minutes-Included_Minutes)*extra_charge,0.0)
Problem
This is the statement that I'm using but it says that no matching function for call to 'max' ``` max((used_minutes-Included_Minutes)*extra_charge,0) ``` Any help would be appreciated. EDIT Code ``` int used_minutes; const int Included_Minutes = 300; double total_charge, extra_charge; cout << "Enter the number of phone call minutes: "; cin >> used_minutes; cout <<"Number of phone call minutes used - included in the base plan: " << min(used_minutes,Included_Minutes) << endl; cout <<"Number of phone call minutes used - not included in the base plan: "<< max(used_minutes-Included_Minutes,0) << endl; extra_charge = 0.10; cout <<"Cost of excess phone call minutes: $"<<fixed << setprecision(2) << max(used_minutes-Included_Minutes)*extra_charge, 0) <<endl; ```