1.分析如图所示组合逻辑电路的功能。要求写出输出Y的逻辑表达式,画出真值表,并说明电路的逻辑功能。
a b c y
0 0 0 0
1 0 0 0
0 1 0 0
1 1 0 0
0 0 1 0
1 0 1 0
0 1 1 0
1 1 1 1
Y = a and b and c
判断a b c是否全是1
#include <stdio.h>
int func(int a, int b, int c)
{
int t1 = a && b;
int t2 = b && c;
int t3 = a && c;
int t = a && b && c;
return t;
}
int main()
{
printf("a\tb\tc\ty\n");
for (int i = 0; i < 8; i++)
{
int a = i % 2;
int b = (i / 2) % 2;
int c = (i / 4) % 2;
int y = func(a, b, c);
printf("%d\t%d\t%d\t%d\n", a, b, c, y);
}
return 0;
}