Write a program which can accept binary numbers and certain operations to calculate the results of t

Write a program which can accept binary numbers and certain operations to calculate the results of t

Write a program in C which can accept binary numbers and certain operations to calculate the results of those operations.

The user should see something like:

Enter a 16 bit unsigned binary number:

Enter operator (+, -, *, %, /, <<, >>, |, &, ^, E)

Enter a 16 bit unsigned binary number:

The answer is: (note: the answer should be displayed in both binary and decimal)

Enter operator (+, -, *, %, /, <<, >>, |, &, ^, E)

Enter a 16 bit unsigned binary number:

The answer is: (note: this should perform the operation on the previous answer and the newly entered number)

The program should continue in this manner, until E is entered as the operator. When E is entered, the program should terminate.

Hints: partition up the problem. Create subroutines to:

• Accept input from the user and verify that they have entered a 16 bit binary number (note: you’ll need to handle binary numbers as strings)

• Convert a string holding a binary number to an unsigned integer

• Convert an unsigned integer to a string holding a binary representation of that number

• Accept two numbers and an operator, perform the noted operation (hint: only capture the first < from << or > from >>, doing so will allow you to handle the operator as a simple character)

Hint #2: use fgets and sscanf to take user input. scanf alone will be tough to get correct.

Follow the process:

•List the inputs & outputs

•Design an algorithm to solve this problem in either pseudocode or with a flowchart

•: Verify the algorithm works

• : Write the program

•: Test the program with a good set of inputs and demonstrate that it is working

"You need a similar assignment done from scratch? Our qualified writers will help you with a guaranteed AI-free & plagiarism-free A+ quality paper, Confidentiality, Timely delivery & Livechat/phone Support.


Discount Code: CIPD30



Click ORDER NOW..

order custom paper