Professional Documents
Culture Documents
Aliena SlidesCarnival
Aliena SlidesCarnival
Aliena SlidesCarnival
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.
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.
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
21
CODE EXAMPLE
22
Binary to X
Conversion
23
CODE EXAMPLE
24
Decimal to X
Conversion
• This batch of code
performs decimal to X
conversion.
25
CODE EXAMPLE
26
Octal to X
Conversion
• This batch of code
performs octal to X
conversion.
27
CODE EXAMPLE
28
Hexadecimal to X
Conversion
• This batch of code
performs hexadecimal to
X conversion.
29
CODE EXAMPLE
30
Helper Methods
31
CODE EXAMPLE
32
Thanks!
Any questions?
You can find me at:
@username
user@mail.me
33