subject

The exercise can be completed by following these steps:

1) Create a C program called ex6.c in C that compiles and runs.

2) Create a makefile to compile and link ex6.c to produce executable ex6

Create a C program that takes user input as separate lines.

As described in earlier discussion sessions, there are several bit operations available in C:

1) Bitwise OR (|)

2) Bitwise AND (&)

3) Bitwise XOR (^)

4) Bit SHIFT (>)

Using the operations, you can mask out certain bits (i. e., zero them), turn on specific bits (i. e., set them to 1), and select specific bits.

Your program will run on the shell command line and will provide a simple command line interface that accepts the following commands. By default, do not print a prompt. All output values are in hexadecimal format.

1) C x n: clear - read in x in hex format and n in decimal, output x with bit n (from LSB starting at 0) cleared

2) M x m: read in x and m in hex and output x masked by m

3) Q: quit

4) S x n: set - read in x in hex format and n in decimal, output x with bit n (from LSB starting at 0) set

5) V x n: read in x in hex and n in decimal, output bit n of x (from LSB starting at 0)

Clear means set a bit to 0. Masking x with mask m means that only all bits of x where the mask is 0 are cleared. Set means set a bit to 1. The maximum input hex value is 0x7 and the maximum decimal value is 31; there are no negative inputs, and you are not required to check for these.

Example Output:

storm:1% make

cc -o ex6 ex6.c

storm:2% ./ex6

V f0f0 0

0

S f0f0 8

f1f0

C f0f0 0

f0f0

M f0f0

f0f0

M 7 e

6

Q

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 01:20
What is the full meaning of rfid in computer
Answers: 2
question
Computers and Technology, 22.06.2019 07:00
Robots with telescoping arms are sometimes used to perform tasks (e.g., welding or placing screws) where access may be difficult for other robotic types. during a test run, a robot arm is programmed to extend according to the relationship r = 3 + 0.5cos(4θ) and the arm rotates according to the relationship θ=−π4t2+πt , where r is in feet, θ is in radians, and t is in seconds. use a computer program to plot the path of tip a in x and y coordinates for 0 ≤ t ≤ 4s.
Answers: 2
question
Computers and Technology, 22.06.2019 21:00
Write a method so that the main() code below can be replaced by the simpler code that calls method original main(): public class calcmiles { public static void main(string [] args) { double milesperhour; double minutestraveled; double hourstraveled; double milestraveled; milesprhour = scnr.nextdouble(); minutestraveled = scnr.nextdouble(); hourstraveled = minutestraveled / 60.0; milestraveled = hourstraveled * milesperhour; system.out.println("miles: " + milestraveled); } }
Answers: 2
question
Computers and Technology, 23.06.2019 22:30
Jamie has to enter the names, employee id’s, and income of a group of employees into a worksheet. which option will jamie use to describe the data
Answers: 3
You know the right answer?
The exercise can be completed by following these steps:

1) Create a C program called ex6...
Questions