Skip to content

Instantly share code, notes, and snippets.

@02015678
Created January 19, 2015 15:06
Show Gist options
  • Save 02015678/eb9dd89a171fbb1cfc7a to your computer and use it in GitHub Desktop.
Save 02015678/eb9dd89a171fbb1cfc7a to your computer and use it in GitHub Desktop.
正在学数字逻辑的我,实在厌倦了那些纯粹推演真值表的题目,太无聊了!于是为了偷懒一下,编写了一下小程序……
#include <stdio.h>
/*本程序用来代替手工推真值表的冗繁工作*/
/*本程序在C-FREE 5 IDE环境下编译通过*/
int main(void)
{
unsigned long A,B,C,D,E,F;
A=0x0000FFFF;//00000000000000001111111111111111
B=0x00FF00FF;//00000000111111110000000011111111
C=0x0F0F0F0F;//00001111000011110000111100001111
D=0x33333333;//00110011001100110011001100110011
E=0x55555555;//01010101010101010101010101010101
/*在这里你可以定制你需要的逻辑表达式*/
/* 这里计算F(A,B,C,D,E)=(A'+B'*C*D)*(B'+C'+D*E') */
F=(~A|~B&C&D)&(~B|~C|D&~E);
printf("%x\n",F);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment