Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.69 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp6
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. while(true)
  14. {
  15. Console.Clear();
  16. Console.Write("Меню:\n" +
  17. "\n" +
  18. "Выберите задачу:\n" +
  19. "1. 1(22)\n" +
  20. "2. 2(22)\n" +
  21. "0. Выход.\n" +
  22. "> ");
  23. switch(Console.ReadLine())
  24. {
  25. case "1":
  26. FirstLogFunc();
  27. break;
  28. case "2":
  29. SecondLogFunc();
  30. break;
  31. case "0":
  32. return;
  33. default:
  34. continue;
  35. }
  36. }
  37. }
  38. static void FirstLogFunc()
  39. {
  40. Console.Clear();
  41. Console.WriteLine("Общий вид логической функции:\n\n" +
  42. "F(x1, x2, x3) = x1 /\\ !(x2 -> x3) <-> !(x2) (+) x3,\n\n" +
  43. "где /\\ - конъюнкция, ! - инверсия, <-> - эквивалентность,\n" +
  44. "-> - импликация, (+) - сложение по модулю.\n");
  45. Console.ReadKey();
  46. Console.WriteLine("Пострить таблицу истинности для:\n" +
  47. "1. F(x, y, z) = x /\\ !(y -> z) <-> !(y) (+) z\n" +
  48. "2. Заданных самостоятельно x1, x2, x3\n" +
  49. "> ");
  50. switch (Console.ReadLine())
  51. {
  52. case "1":
  53. SheetForFirst(1, 2, 3);
  54. break;
  55. case "2":
  56. break;
  57.  
  58. }
  59. }
  60. static void SheetForFirst(int x1, int x2, int x3)
  61. {
  62. Console.Clear();
  63. bool[,] xyz = { {false,false,false },{false,false,true },{false,true,false },{false,true,true },{true,false,false },{true,false,true },{true,true,false },{true,true,true } };
  64. Console.WriteLine(" x | y | z | F");
  65. Console.WriteLine("---|---|---|---");
  66. for (int i = 0; i < 8; i++)
  67. Console.WriteLine($" {xyz[i,0] ? '1' : '0'} | {xyz[i, 1]} | {xyz[i, 2]} | {(xyz[i, 0]&&(!(!xyz[i, 1])|| xyz[i, 2])) == (!xyz[i, 1]) ^ xyz[i, 2]}");
  68. Console.ReadLine();
  69.  
  70. }
  71. static void SecondLogFunc()
  72. {
  73.  
  74. }
  75. }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement