invalid operands of types ‘int’

2018-10-22  本文已影响65人  顽强的猫尾草

程序:

cout << num1 ^ num2 << endl;

错误:invalid operands of types ‘int’ and ‘<unresolved overloaded function type>’ to binary ‘operator<<’
原因:<< 的优先级比 ^ 要高
解决:加括号变为 (num1 ^ num2)

上一篇 下一篇

猜你喜欢

热点阅读