Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part 2 The second part of this homework is a program that should be written per the description below and turned in to the Canvas

image text in transcribed

Part 2 The second part of this homework is a program that should be written per the description below and turned in to the Canvas assignment for Homework #3. Turn in just a single source code file for the assignment. The program will be tested with goc under Cygwin. Write a program that takes two command line arguments at the time the program is executed. You may assume the user enters only signed decimal numeric characters. The input must be fully qualified, and the user should be notified of any value out of range for a 22-bit signed integer. The first argument is to be considered a data field. This data field is to be is operated upon by a mask defined by the second argument. The program should display a menu that allows the user to select different bit-wise operations to be performed on the data by the mask. The required operations are: Set, Clear and Toggle. Both data and mask should be displayed in binary format. And they must be displayed such that one is above the other so that they may be visually compared bit by bit. If data and mask are both within the range for signed 8 bit values, then the binary display should only show 8 bits. If both values are within the range for signed 16 bit values, then the binary display should only show 16 bits. The menu must also allow the user to re-enter a value for data and re-enter a value for the mask. Use scanf() to read data from the user at runtime and overwrite the original values provided at execution time. All user input must be completely qualified to meet the requirements above (up to 22-bit signed integer values). Printing binary must be done with shifting and bitwise operations. Do NOT use arrays. No multiplication or division is needed to produce binary output to the screen. Part 2 The second part of this homework is a program that should be written per the description below and turned in to the Canvas assignment for Homework #3. Turn in just a single source code file for the assignment. The program will be tested with goc under Cygwin. Write a program that takes two command line arguments at the time the program is executed. You may assume the user enters only signed decimal numeric characters. The input must be fully qualified, and the user should be notified of any value out of range for a 22-bit signed integer. The first argument is to be considered a data field. This data field is to be is operated upon by a mask defined by the second argument. The program should display a menu that allows the user to select different bit-wise operations to be performed on the data by the mask. The required operations are: Set, Clear and Toggle. Both data and mask should be displayed in binary format. And they must be displayed such that one is above the other so that they may be visually compared bit by bit. If data and mask are both within the range for signed 8 bit values, then the binary display should only show 8 bits. If both values are within the range for signed 16 bit values, then the binary display should only show 16 bits. The menu must also allow the user to re-enter a value for data and re-enter a value for the mask. Use scanf() to read data from the user at runtime and overwrite the original values provided at execution time. All user input must be completely qualified to meet the requirements above (up to 22-bit signed integer values). Printing binary must be done with shifting and bitwise operations. Do NOT use arrays. No multiplication or division is needed to produce binary output to the screen

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Upgrading Oracle Databases Oracle Database New Features

Authors: Charles Kim, Gary Gordhamer, Sean Scott

1st Edition

B0BL12WFP6, 979-8359657501

More Books

Students also viewed these Databases questions