a&&b --> 就是判断a和b中是否含有0
只要a,b中有一个0,结果即为0;
否则为1;
a||b --> 就是判断a和b中是否全为0
只有a,b全为0时才为0;
否则为1;
# include <bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c = 9;
while( c-- )
{
cin >> a >> b;
int d = a||b, f = a&&b;
cout<<a<<" "<<b<<" "<<d<<" "<<f<<endl;
}
return 0;
}
输入
1 0
1 1
98 98
98 5
6 5
0 0
0 1
1 0
输出
1 0 1 0
1 1 1 1
98 98 1 1
98 5 1 1
6 5 1 1
0 0 0 0
0 1 1 0
1 0 1 0
1 0 1 0