Monday, August 26, 2019

Binary numeral system

Binary numeral system
Binary numerical system is a base of programming. Machine was designed to manipulate with numbers. Binary system was chosen because it is the easiest way to save numbers. If one capacitor contains charge it means it is 1 else 0.
Let’s imaging we need to save some numbers, and we do not have regular digits. For example, we can have one apple. We want to save this number somehow. We will use one regular lamp to do it.
A close up of a logo

Description automatically generated
If no apple exists, then we have:
A close up of a logo

Description automatically generated
If we have one apple:
Hope it is clear.
Now we can have up to two apples. One lamp it is not enough to save this number. So, let’s use two lamps.
A close up of a logo

Description automatically generatedA close up of a logo

Description automatically generated
There are two ways to save number with two lamps.
First way, number of turned on lamps equals number of apples we have
    1.       If one lamp turned on, we have one apple
    2.       If two lamps turned on, we have two apples.
    3.       If no lamp turned on, we do not have an apple.
It is not the best solution of doing it. Because those two combinations are identical:
A close up of a logo

Description automatically generated                A close up of a logo

Description automatically generated
On both we have only one lamp turned on, which means we have one apple.
Second way, position of lamp should show another number.
One apple: A close up of a logo

Description automatically generated
Two apples: A close up of a logo

Description automatically generated
Lamp can have only two states: off and on. If lamp is on then we have one apple, if we need to save a higher number, we should turn on next lamp and turn off current. So, lamp in next position represent number two. If we want to save number three, we can use first lamp:
If we want to save number four, we need to have extra lamp:
A close up of a logo

Description automatically generatedA close up of a logo

Description automatically generated
Now we have one on lamp and two off lams. It is means we can add extra three combinations based from previous paragraph.
Each extra lamp represent number that twice (because binary system) higher than previous.
128
64
32
16
8
4
2
1




Export to Excel in C#

Hello. I would like to show you how to export data in C# . Check out GitHub repository to find code discussed in this article: https:/...