3
这是我使用的语句,但它说,对于呼叫没有匹配的功能,“最大”错误在Xcode中“不呼叫到‘最大’匹配功能”
max((used_minutes-Included_Minutes)*extra_charge,0)
任何帮助将是赞赏。
EDIT
代码
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;
'std :: max'和'std :: min'位于算法标题中。 – Brian
我已经使用#include,但不会工作 –
user3317815
如果您发布可编译示例,这将有所帮助。您的帖子中的调用没有任何意义,因为它似乎是在尝试将指针与零比较。两个输入必须是完全相同的类型。 – shawn1874