Accept input from the user and verify that they have


(PROGRAMMING IN C)

Write a program 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.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Accept input from the user and verify that they have
Reference No:- TGS02901385

Expected delivery within 24 Hours