逻辑函数Y(如下图)的最简与—或表达式为?
2条回答 默认 最新
- threenewbee 2019-04-13 11:11关注
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Q756543 { class Program { static bool Compare(Func<bool, bool, bool, bool> f1, Func<bool, bool, bool, bool> f2) { for (int i = 0; i < 8; i++) { bool a = i % 2 != 0; bool b = (i / 2) % 2 != 0; bool c = (i / 4) % 2 != 0; if (f1(a, b, c) != f2(a, b, c)) return false; } return true; } static void Main(string[] args) { Func<bool, bool, bool, bool> Y = new Func<bool, bool, bool, bool>((a, b, c) => (a && b) || (!a && b) || (a && b && c) ); Console.WriteLine(Compare(Y, (a, b, c) => b || !a )); Console.WriteLine(Compare(Y, (a, b, c) => b || (a & c) )); Console.WriteLine(Compare(Y, (a, b, c) => a || b )); Console.WriteLine(Compare(Y, (a, b, c) => b )); } } }
False
False
False
True
Press any key to continue . . .所以选D
解决 无用评论 打赏 举报