美文网首页
invalid operands of types ‘int’

invalid operands of types ‘int’

作者: 顽强的猫尾草 | 来源:发表于2018-10-22 20:30 被阅读65次

程序:

cout << num1 ^ num2 << endl;

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

相关文章

网友评论

      本文标题:invalid operands of types ‘int’

      本文链接:https://www.haomeiwen.com/subject/roknzftx.html