Xcode "No matching function for call to 'max'" 上的错误
Error on Xcode "No matching function for call to 'max'"
这是我正在使用的语句,但它说没有匹配函数来调用"max"
max((used_minutes-Included_Minutes)*extra_charge,0)
任何帮助将不胜感激。
编辑
法典
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()
要求第一个和第二个参数属于同一类型。 extra_charge 是一个双精度值,导致第一个和第二个参数具有不同的类型。尝试:
max((used_minutes-Included_Minutes)*extra_charge,0.0)
相关文章:
- 警告处理为错误这里有什么问题
- "error: no matching function for call to"构造函数错误
- boost::进程间消息队列引发错误
- C++,OpenCV,尝试显示图像时"OpenCV(4.3.0) Error: Assertion failed (size.width>0 && size.height>0)"此错误
- 有关插入适配器的错误。[错误]请求从 'back_insert_iterator<vector<>>' 类型转换为非标量类型
- QT在错误的班级中寻找空位
- vector.resize()中的分配错误
- 代码在main()中运行,但在函数中出现错误
- 释放错误后堆使用
- (C++)分析树以计算返回错误值的简单算术表达式
- Project Euler问题4的错误解决方案
- 我的字符计数代码计算错误.为什么
- 为什么 c++ 编译器在对两种不同类型的数值变量使用"std::max()"函数时会出现错误
- 为什么在第 12 行"if(k>=max)"中给出错误说 " reference to max is ambiguous" ?
- gcc添加符号时出现无效版本(max)错误:值错误
- 当我尝试编译程序时,我遇到了一堆错误,例如:'std::max':找不到匹配的重载函数
- Xcode "No matching function for call to 'max'" 上的错误
- 标准::numeric_limits::max的语法错误
- 错误:重载的“max(int, int)”的调用不明确
- 属性错误: 'Foo'对象没有属性'max'