Aliena SlidesCarnival

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 33

Binary

Operations &
Number System
Conversion
Menu-Driven Program in C#

2
Main Menu
Main Menu:
[1] Binary Operations
[2] Number System Conversion
[3] Exit

3

• -This batch of code displays
the main menu with options for
binary operations, number
system conversion, and
program exit.

• It reads the user's choice and


handles it accordingly using a
switch statement.

4
CODE EXAMPLE
Binary Operations
Menu
Binary Operations Menu:
[1] Division
[2] Multiplication
[3] Subtraction
[4] Addition
[5] Negative (2's Complement)
[6] Back to Main Menu
• Displaying the binary operations
menu options.
• Users can select various binary
operations or return to the main
menu.

7
CODE EXAMPLE

8
Number System
Conversion Menu
Number System Conversion Menu:
[1] Binary to X
[2] Decimal to X
[3] Octal to X
[4] Hexa to X
[5] Back to Main Menu

9
• Displaying the number
system conversion menu
options.

• Users can choose the


type of conversion or
return to the main menu.

10
CODE EXAMPLE

11
BINARY
OPERATIONS
[1] Division
[2] Multiplication
[3] Subtraction
[4] Addition
[5] Negative (2's Complement)

12
Binary Division
• This batch of code performs
binary division.
• It prompts the user for the
dividend and divisor, calculates
the quotient and remainder, and
displays the results.

13
CODE EXAMPLE

14
Binary Multiplication
• This batch of codeperforms
binary multiplication.
• It prompts the user for two
binary numbers, calculates
their product, and displays
the result.

15
CODE EXAMPLE

16
Binary
Subtraction
• This batch of code performs
binary subtraction.
• It prompts the user for the
minuend and subtrahend,
calculates the result, and
displays it.

17
CODE EXAMPLE

18
Binary Addition
• This batch of code performs
binary addition.
• It prompts the user for two
binary numbers, calculates their
sum, and displays the result.

19
CODE EXAMPLE

20
2's Complement

• This batch of code


performs 2's complement.
• It prompts the user for a
binary number, calculates
its 2's complement, and
displays the result.

21
CODE EXAMPLE

22
Binary to X
Conversion

• This batch of code performs


binary to X conversion.

• It prompts the user for a


binary number, converts it to
decimal, and then converts
the decimal to other bases
(octal and hexadecimal).

23
CODE EXAMPLE

24
Decimal to X
Conversion
• This batch of code
performs decimal to X
conversion.

• It prompts the user for a


decimal number, converts
it to binary, octal, and
hexadecimal, and displays
the results.

25
CODE EXAMPLE

26
Octal to X
Conversion
• This batch of code
performs octal to X
conversion.

• It prompts the user for an


octal number, converts it
to decimal, and then
converts the decimal to
binary and hexadecimal.

27
CODE EXAMPLE

28
Hexadecimal to X
Conversion
• This batch of code
performs hexadecimal to
X conversion.

• It prompts the user for a


hexadecimal number,
converts it to decimal, and
then converts the decimal
to binary and octal.

29
CODE EXAMPLE

30
Helper Methods

• These helper methods


validate binary, octal, and
hexadecimal inputs to
ensure they contain valid
characters.

• They are used throughout


the program to prevent
invalid inputs.

31
CODE EXAMPLE

32
Thanks!
Any questions?
You can find me at:
@username
user@mail.me

33

You might also like