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;
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With