逻辑与和条件与的区别(&&和&)

来源:互联网 发布:windows系统官方下载 编辑:程序博客网 时间:2024/05/17 01:59

#include <iostream>
#include <string>
using namespace std;


int main()
{
int a = 5;
int b = 2;
int c = a|b;
int d = 3;
if (a&&b)
{
  cout<<"123"<<endl;
}
else
{
  cout<<"条件错误!"<<endl;
}

cout<<"&&&&&&&&&&&&&&&&&&&&&"<<endl;
if (a&b)
{
  cout<<"456"<<endl;
}else
{
  cout<<"错误逻辑!"<<endl;
}
}

我想稍微动一下脑筋你就会知道他们的区别!
看看它的执行结果吧!
原创粉丝点击