C#/how to represint the prodict of sum in c#
ineed to programm the pos & sop of digital design
using c#
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Kirtan PatelPosted Nov 29, 2009, 1:02 PM
Here is Constructed Logic for Sum of Product For 3 bit ( 8 Combination) 3 FlipFlops
if my answer helps you then check "do you like this answer check box" please :)
using System.Collections.Generic;
{
class Program
{
static void Main(string[] args)
{
Dictionary<string, int> BinaryAndOutput = new Dictionary<string, int>();
//Construct Binary table 000 001 010 011 100 etc and Store In Dictionary
//Construct Binary counts and Assign Output to Each Count
for (int x = 0; x <= 1; x++)
{
for (int y = 0; y <= 1; y++)
{
for (int z = 0; z <= 1; z++)
{
string binary = x.ToString() + y.ToString() + z.ToString();
Console.WriteLine("Enter Desire Output for " + binary + ":");
int value = int.Parse(Console.ReadLine());
BinaryAndOutput.Add(binary,value);
}
}
}
//Construct SOP
string sop = "";
foreach (KeyValuePair<string,int> k in BinaryAndOutput)
{
char[] temp = k.Key.ToString().ToCharArray();
char var ='A';
if (k.Value == 1)
{
foreach (char c in temp)
{
if (c == '1')
{
sop = sop + var;
var++;
}
else
{
sop = sop + var + "'";
var++;
}
}
sop += "+";
}
}
Console.WriteLine("\n\n********** Sum of Product ************\n");
Console.WriteLine(sop);
Console.ReadKey();
}
}
}
Hiren SoniPosted Nov 29, 2009, 10:59 AM