Accept input from the user and verify that they have entered

Assignment Help Computer Engineering
Reference no: EM132107930

(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.

Reference no: EM132107930

Questions Cloud

Write a program to load the names in the combo box : Create an SQL or Access database with all your friends' information and write a program to load the names in the combo box.
Present value of the cash flows : What is the present value of the cash flows from your lottery winnings?
Test case a single line comprising the passages : IBM cognitive computing|IBM "cognitive" computing is a revolution| ibm cognitive computing|'IBM Cognitive Computing' is a revolution?
What is the modified duration of portfolio : The term structure is flat, and all spot rates are 3%. What is the modified duration of your portfolio?
Accept input from the user and verify that they have entered : 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)
What interest rate would you expect to pay on the issue : If the 10 year maturity premium is 0.4%, what interest rate would you expect to pay on the issue?
Create an array of pointers to cards that are in the correct : In this problem you will shuffle a deck of cards where each card is represented by a twocharacter string.
Required rate of return on stocks : What should the firm's price-to- earnings (P/E) ratio be if the required rate of return on stocks of this type is 15 percent?
Provide a comparison to the health care organization : Research a health care organization or a network that spans several states within the U.S. (Example: United Healthcare, Vanguard, Banner Healthcare, etc.)

Reviews

Write a Review

Computer Engineering Questions & Answers

  What is a perfect decomposition

What is a perfect decomposition? Discuss differences in program replication techniques on mulcicomputers as opposed to program partitioning on multiprocessors.

  Identify the positive and negative aspects of the website

COIS 12036 Human Computer Interaction Provide an overview and description of the nominated website and identify and elaborate the main feature or features of the website.

  Write an if-else statement that outputs the word high

Write an if-else statement that outputs the word High if the value of the variable score is greater than 100 and Low if the value of score is at most 100.

  What languages should a developer be able to use

In addition to HTML, what languages should a developer be able to use (through knowledge or through tools) in order to create dynamic and interactive websites?

  Write programs to generate a random text string

Write programs to generate a random 1000-bit text string, then find all occurrences of the last k bits elsewhere in the string, for lc= 5,10,15.

  How many times is the multiply routine executed

How many times is the multiply routine executed in the set of programs? How much faster (or slower) is M2 than M1?

  Compute and return the number of strings of a as and b bs

Compute and return number of strings of a A's, b B's, and c C's. For example, f(1, 2, 1) returns 12 because there are 12 strings made up of 1 A, 2 B's and 1 C.

  Write a cpp class for the implementation of regular graphs

A graph is regularif every vertex has the same valence. Write a C++ class specification for this implementation of regular graphs.

  Create class named circle with fields named radius and area

Create a class named Circle with fields named radius, area, and diameter. Include a constructor that sets the radius to 1. Also include public properties for each field.

  Describe the key analogies the monitors expose to users

Describe the key analogies and concepts these monitors expose to users, including the task-domain objects users manipulate on the screen. Determine the conceptual model that you would use when designing a product for your restaurant.

  Develop a requirements definition for the new system

Develop a requirements definition for the new system. Include both functional and nonfunctional system requirements. Pretend that you will release the system in three different versions. Prioritize the requirements accordingly.

  What factors are important in your decision

Decide what factors are important in your decision as to which computer to buy and list them. After you select the system you would like to buy, identify which terms refer to hardware and which refer to software.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd