C++异或简单问题跪求高手解答

2025-03-06 18:46:06
推荐回答(5个)
回答1:

没什么问题吧?
a:00000011(3)
b:00000010(2),异或运算后
c:00000001(1)
显示1。很正常啊!(VC6.0结果)

回答2:

^是位的异或运算 不是乘方
不知道你是真的要异或运算还是想算乘方但误以为^是乘方的意思

回答3:

测试通过,
如果是提示:fatal error C1010: unexpected end of file while looking for precompiled header directive
可能是你忘了加头文件#include "stdafx.h"

回答4:

看程序没问题 可能你要的是这种结果吧
#include
using namespace std;
int main()
{
int a=3,c;
c=a*a;
cout< return 0;
}

回答5:

如果是编译错误,且用的是VC6.0或以下版本,可以试着把using namespace std;删了。