Write the function-like macro testbit

Assignment Help Computer Engineering
Reference no: EM132208317

Question :

Write a program that asks the user for an integer value (may be negative) and that outputs the bit pattern for that integer, starting with the most significant bit. You should use an int data type which, on nearly all modern compilers, is a 32-bit value.

Your output should print the decimal value, the 8-digit hexadecimal representation, and the 32-bit binary bit pattern with the bits in groups of four separated by a space.

You are required to write (and use) the function-like macro testbit(integer, position) that evaluates to true (1) or false (0) depending on if the bit in the indicated position (with 0 being the least significant bit) is a 1 or 0, respectively.

Run your program for a selection of small, moderate, and large integer values, both positive and negative, placing the results in a ReadMe.txt file.

NOTE: DO NOT to use any library functions that perform the significant tasks, such as rounding a value to the nearest cent.

Reference no: EM132208317

Questions Cloud

Display the numbers from 1 to 10 squared : Use a counter-controlled while loop to display the numbers from 1 to 10 squared on the next line with a space between each value.
Explain the chemistry of water : Explain the chemistry of water. Why water important in biological systems? Define anabolism and catabolism, discuss how they relate to homeostasis and survival
Calculate the labour force participation rate : Calculate the Unemployment Rate. Show calculations. Show work. Calculate the Labour Force Participation Rate. Show work.
Creative problem definition challenge : Creative Problem Definition Challenge assume the position of the executive director of the facility asked to define the problem as accurately as possible
Write the function-like macro testbit : Write a program that asks the user for an integer value (may be negative) and that outputs the bit pattern for that integer.
Write a program that asks the user for a word or phrase : Write a program that asks the user for a word or phrase and then prints out the number of vowels in the word or phrase.
Write the program for atm machine and show that it works : The user should enter the amount desired (a multiple of 10 dollars) and the machine dispenses this amount using the least number of bills.
Contrast the given views with mercantilism : Contrast these views with mercantilism. Cite primary sources from the early mercantilist philosophers. You can find a list of mercantilist philosophers.
Why lung cancer cluster in a family for non-genetic reasons : One of the most devastating diseases in American communities today is lung cancer. Discuss why lung cancer might cluster in a family for non-genetic reasons

Reviews

Write a Review

Computer Engineering Questions & Answers

  Discuss the challenges that incident handlers face

Discuss the challenges that incident handlers face in identifying incidents when resources have been moved to a cloud environment.

  Write a complete program to find the minimum value in a file

Write a complete program to find the minimum value in a file containing an unknown number of integers.

  Why must a latch be used to interface an output device

Why must a latch be used to interface an output device to the data bus? [a, c) For a CPU performing a write cycle, why does the CPU place the data on the data.

  Assess security-privacy concerns in applications

Do you feel that the STRIDE model, which is discussed extensively in this course, is a good baseline to help assess security/privacy concerns in applications.

  How you would solve the general line-intersection problem

Describe how you would solve the general line-intersection problem given the additional fact that the minimum separation between two lines is greater.

  What are the penalties for illegally copying software

What are the penalties for illegally copying software? Are there circumstances under which it is acceptable to copy a program?

  Discuss the relationship between healthcare quality and cost

Discuss the relationship between healthcare quality, access, and costs and how these three influence one another in our healthcare system. Also, identify factors in our system that may have an impact on these concepts.

  Examine the model performance on the validation set

Examine the model performance on the validation set. What is the accuracy rate? Is one type of misclassification more likely than the other?

  What hardening guidelines or standards are you familiar with

What hardening guidelines or standards are you familiar with? What function do each of the strategies discussed serve?

  Display the largest and second largest values

Write a C++ program that reads integers from a file on disk and then displays the largest and second largest values. You must use a C++ loop in this program.

  How much of companys network capacity are employee consuming

How much of the company's network capacity are employees consuming when watching YouTube videos? What percentage of available bus cycles on employees' computers are consumed when watching the videos?

  Describe a way to keep track of the pairs of meeting players

Suppose you are designing a multi-player game that has n = 1000 players. Describe a way to keep track of the pairs of meeting players and who is the winner.

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