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 17:40
Gabe wants to move text from one document to another document. he should copy the text, paste the text, and open the new document highlight the text, select the cut command, move to the new document, make sure the cursor is in the correct location, and select the paste command select the save as command, navigate to the new document, and click save highlight the text, open the new document, and press ctrl and v
Answers: 1
question
Computers and Technology, 22.06.2019 23:30
What are some ways to use a range name in a formula? check all that apply. in the defined names group, click use in formula, and then select the desired name. begin typing the name in the formula, select a name from the autocomplete list, and use the arrow keys and tab key to enter the name in the formula. begin typing the formula, and then click and drag with the mouse to select the cells to include in the formula. right-click one of the cells in the range. click formula options, and use the dialog box to add the name.
Answers: 1
question
Computers and Technology, 23.06.2019 01:30
Jason works as an accountant in a department store. he needs to keep a daily record of all the invoices issued by the store. which file naming convention would him the most? a)give the file a unique name b)name the file in yymmdd format c)use descriptive name while naming the files d)use capital letters while naming the file
Answers: 3
question
Computers and Technology, 23.06.2019 03:50
Iam a bacterium. i cause stomach cramps and diarrhea. i am caused by eating rotten foodssuch as chicken, fish, or eggs. sometimes turtles carry my bacteria.what am i?
Answers: 2
You know the right answer?
The exercise can be completed by following these steps:

1) Create a C program called ex6...
Questions
Questions on the website: 13722361