请帮我看一下,这个语法含义是这样的?

bingxin100321 bingxin100321 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
if((int)(bdstr[i]^bdstr[i+len/2])!=0)
是判断bdstr[i]与bdstr[i+len/2])求异或后的值是否是0,对吗?但是运行结果是错误的,这句话含义对吗?下面是整个函数

#include <iostream>
#include <iomanip>
#include <math.h>
#include <string>
using namespace std;
/*---------------------------------------------*/
bool check(char *bdstr)
{
bool FALSE=0;
bool TRUE=1;
bool IsTrue=TRUE;
int i;
char sum;
int len;
len=strlen(bdstr);
for (i=0;i<len/2;i++)
{
//sum^=buf[i];
if((int)(bdstr[i]^bdstr[i+len/2])!=0)
{
IsTrue=FALSE;
break;
}
}
cout<<IsTrue<<endl;
return IsTrue;
}
void main()
{
int sum;
char *p="101010";
check(p);
}
...全文

相关推荐

评论 9
收藏 已收藏
分享
返回顶部
bingxin100321
C++ 语言 65,214 成员 250,514 内容