【发布时间】:2011-08-12 02:26:44
【问题描述】:
std::max 有问题。我想不通。
int border = 35;
int myInt = 2;
int myOtherInt = 3;
int z = std::max(myInt + 2 * border, myOtherInt + 2 * border);
我已包含算法标准标头。当我将鼠标悬停在 max 上时,我得到:
错误:需要一个标识符
还有一个编译错误:
错误 C2589:
'(':'::'右侧的非法令牌
错误 C2059:语法错误:'::'
怎么了?
【问题讨论】:
-
你加入了
<algorithm>吗?你包括<windows.h>吗? -
OP sez:“我已经包含了算法标准头。”
-
您能否提供一个我们可以尝试编译的完整示例?你的程序足够短。
-
不相关,但如果你写
std::max(myInt, myOtherInt) + 2 * border;,它似乎会更短更容易阅读
标签: c++