Question: To get input from the user, enter these commandlTo get input from the user, enter these commandline arguments: four characters ( any ASCII character )
To get input from the user, enter these commandlTo get input from the user, enter these commandline arguments: four characters any ASCII character followed by two integers.Otherwise print error message and end program.
To convert a string to an integer, use the function atoi For example:int integer atoiargv;
Use data types "unsigned int" and "unsigned char". Be careful with looping, as there will be no negative integers.
Function #: This function calculates the two's complement. The function's parameter is one unsigned integer unsigned int The function returns a signed integer int which is the two's complement of the parameter. Use the one's complement operator ~ to get the one's complement. Add one to the to the one's complement to get the two's complement.
Function #: This function packs four characters into one integer. The function's parameters are four unsigned characters. The function returns an unsigned integer. Use the left shift operator and the bitwise inclusive OR operator to pack four bit characters into a bit integer.
Function #: This function unpacks an integer into four characters. The function's parameters are an unsigned integer which is input to the function and four character pointers which are the outputs of the function This function does not return anything. Use the rightshift operator and the bitwise AND operator & with a mask to separate the bit integer into four bit parts, and store these four bit parts in the four bit characters. In other words, take one bit integer int and convert it into four bit characters char
Here is an example function prototype:
void unpackCharactersunsigned int, unsigned char unsigned char unsigned char unsigned char;
Function #: This function is a circular left shift of the bits. The function's parameter are two unsigned integers: integer and integer The function returns an unsigned integer. This function will return an unsigned integer with integers bits rotated to the left integers number of times. You may need to use a mask, left shift operator right shift operator the bitwise AND operator & and the bitwise inclusive OR operator
In other words, when the bits are shifted to the left by one, the bit in the leftmost position will be moved to the rightmost position. When the bits are shifted to the left by the bits in the leftmost position will be moved to the rightmost position. Etc.
One possible solution is for the circular left shift operation is:
circularLeftShiftn xx n OR x n
Replace the OR with the inclusive or operator
Here is an outline of the program with the four function prototypes described in the instructions:LastnameFirstnamec
Your output should match the output below. You can use the printbits function in your code; however, you also need to create your own function that displays the eight bits in a character.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
