error C2297: '<<' : illegal, right operand has type 'char [5]'求大神看看哪儿错了...
#include<iostream>usingnamespacestd;intmain(void){intcc1,cc2,cc3,cc4,cc5,cc6;for(intA...
#include<iostream>
using namespace std;
int main(void)
{
int cc1,cc2,cc3,cc4,cc5,cc6;
for(int A=0;A<=1;A=A+1)
for(int B=0;B<=1;B=B+1)
for(int C=0;C<=1;C=C+1)
for(int D=0;D<=1;D=D+1)
for(int E=0;E<=1;E=E+1)
for(int F=0;F<=1;F=F+1)
{
cc1=A||B;
cc2=!(A&&D);
cc3=(A&&E)||(A&&F)||(E&&F);
cc4=(B&&C)||(!B&&!C);
cc5=(C&&!D)||(D&&!C);
cc6=D||(!D&&!E);
if(cc1+cc2+cc3+cc4+cc5+cc6==6)
{
cout<<"A:"<<A==0?"不是":"是"<<"罪犯"<<endl;
cout<<"B:"<<B==0?"不是":"是"<<"罪犯"<<endl;
cout<<"C:"<<C==0?"不是":"是"<<"罪犯"<<endl;
cout<<"D:"<<D==0?"不是":"是"<<"罪犯"<<endl;
cout<<"E:"<<E==0?"不是":"是"<<"罪犯"<<endl;
cout<<"F:"<<F==0?"不是":"是"<<"罪犯"<<endl;
}
}
return 0;
} 展开
using namespace std;
int main(void)
{
int cc1,cc2,cc3,cc4,cc5,cc6;
for(int A=0;A<=1;A=A+1)
for(int B=0;B<=1;B=B+1)
for(int C=0;C<=1;C=C+1)
for(int D=0;D<=1;D=D+1)
for(int E=0;E<=1;E=E+1)
for(int F=0;F<=1;F=F+1)
{
cc1=A||B;
cc2=!(A&&D);
cc3=(A&&E)||(A&&F)||(E&&F);
cc4=(B&&C)||(!B&&!C);
cc5=(C&&!D)||(D&&!C);
cc6=D||(!D&&!E);
if(cc1+cc2+cc3+cc4+cc5+cc6==6)
{
cout<<"A:"<<A==0?"不是":"是"<<"罪犯"<<endl;
cout<<"B:"<<B==0?"不是":"是"<<"罪犯"<<endl;
cout<<"C:"<<C==0?"不是":"是"<<"罪犯"<<endl;
cout<<"D:"<<D==0?"不是":"是"<<"罪犯"<<endl;
cout<<"E:"<<E==0?"不是":"是"<<"罪犯"<<endl;
cout<<"F:"<<F==0?"不是":"是"<<"罪犯"<<endl;
}
}
return 0;
} 展开
1个回答
展开全部
操作符优先级的问题,把?:表达式加个括号
if (cc1+cc2+cc3+cc4+cc5+cc6==6)
{
cout<<"A:"<<(A==0?"不是":"是")<<"罪犯"<<endl; //加括号,下同
cout<<"B:"<<(B==0?"不是":"是")<<"罪犯"<<endl;
cout<<"C:"<<(C==0?"不是":"是")<<"罪犯"<<endl;
cout<<"D:"<<(D==0?"不是":"是")<<"罪犯"<<endl;
cout<<"E:"<<(E==0?"不是":"是")<<"罪犯"<<endl;
cout<<"F:"<<(F==0?"不是":"是")<<"罪犯"<<endl;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询