Click here to Skip to main content
12,547,806 members (35,173 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


7 bookmarked

Truth table and simplification of a boolean expression

, 16 Jun 2014 CPOL
Rate this:
Please Sign up or sign in to vote.
generation of Karnaugh table


The Karnaugh map, also known as the K-map, is a method to simplify boolean algebra.

Karnaugh maps are used to facilitate the simplification of Boolean algebra functions. Take the Boolean function described by the following truth table.

 this article, and specially the attached code, is for you.


The reader should have basic notions of boolean algebra;Knowledge of the Quine McKluskey algorithm is optimal. Basic notions of C# are required for understanding the code.

Using of the application 

first we have to introduce the booleane expression to the textbox, this one must use only(a;b:c:d;!,+) as character, when we click the button of table truth generation the listview ll be filled by the appropriate values. in the variables fields   or sub-functions fields  or Function fields .

then, the Karnaugh button appears, and if we click it, the Karnaugh table ll be generated and filled.  

Now to simplify the expression we use tow methods the first is to simplify tow terms and return the simlified expression  


        <span style="color: rgb(0, 0, 0); font-family: Consolas, 'Courier New', Courier, mono; font-size: 12px; white-space: pre; background-color: rgb(251, 237, 187);">public string simplifier1(int i,int j,int order)

the socond make all simplifications possible in the Karnaugh table

public void evaluer(int order)
        int s = 0;
        for (int i = 0; i < Form1.j; i++)
            for (int k = i; k < Form1.j; k++)
                simplifier1(i, k, order);
                if ((lstTerms[order].GetItemCheckState(i) == CheckState.Checked) && (lstTerms[order].GetItemCheckState(k) == CheckState.Checked))
                    if (!tab.Contains(simplifier1(i, k, order)) && !Form1.local_tab.Contains(simplifier1(i, k, order)))
                        tab[s] = simplifier1(i, k, order);
                        lstTerms[order+1].SetItemChecked(s, false);


        for (int i = 0; i < Form1.j; i++)
            Form1.local_tab[i] = " ";

            Form1.j = s;
            for (int i = 0; i < Form1.j; i++)
                Form1.local_tab[i] = tab[i];
                tab[i] = " ";
            if (s == 0)
                arret = true;

and that what we have as result


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Amar zaidi
Algeria Algeria
No Biography provided

You may also be interested in...


Comments and Discussions

GeneralCannot Download the ZIP File Pin
Member 1004250111-Oct-16 4:59
memberMember 1004250111-Oct-16 4:59 
Questiondownload Pin
TerryM7928-Feb-15 8:19
memberTerryM7928-Feb-15 8:19 
General[My vote of 1] Vote 1 Pin
TonBill18-Jun-14 2:30
memberTonBill18-Jun-14 2:30 
GeneralMy vote of 1 Pin
LostTheMarbles16-Jun-14 2:48
professionalLostTheMarbles16-Jun-14 2:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.161021.1 | Last Updated 16 Jun 2014
Article Copyright 2014 by Amar zaidi
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid