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