Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C programming AaBbCeDdE AaBbCcDdEs AaBbCcDdE AaBbCcDd Heading 1 Normal No Spacing Tale Subtitle o Bitwise Operations o Masking Program: Write a C program to extract

C programming image text in transcribed
image text in transcribed
image text in transcribed
AaBbCeDdE AaBbCcDdEs AaBbCcDdE AaBbCcDd Heading 1 Normal No Spacing Tale Subtitle o Bitwise Operations o Masking Program: Write a C program to extract some information from a whole number for a secret mission as follows: The unit number: The lowest 3 bits in the number represent the unit number. For example if the number in binary is 01011001, the unit number will be 1. The safety signal: The 7 bit from the right is the safety signal. 1 indicates safety and 0 indicates danger. For example if the number in binary is 01011001, the signal is 1 and indicates safety. Number of tanks: The bits 4, 5, 6 from the right represents the number of missiles. For example if the number in binary is 01011001, digits 4, 5, 6 are 011 indicate 3 tanks. Function Prototype: Write function prototypes at the beginning of the program before main0. o Write the function definitions (the code) after main0 Required Function: Every function must be preceded with 4 lines ofcomments describing its name, input(s), output type, and task 1) gect sods0) function Input parameter: None Output: int -Task: prompt the user to enter a whole number in range of.-5000 and 5000, both inclusive (values in this range fit in 2 bytes (16 bits) in memory. to validate the range of the number Validation: Use a loop 2) display.binary0 function Input parameter: int .Output: void * Task: Display the input number in 16 bit binary, Display a space between every 4 bits for clarity main) o Declare variables of type int to store the input Number (code), unit number, signal, and tanks,... o Invoke the function get .code and store its output in variable code. o Display the code in hexadecimal (use ghX in print). o Invoke the function displax-bina?( ) to display the code in binary. o Declare a mask for unit number the lowest 3 bits in the code

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

Students also viewed these Databases questions