Question
the code for part 2 do not compile so it needs to be fixed to be able and part 3 the most important thin is
the code for part 2 do not compile so it needs to be fixed to be able and part 3 the most important thin is to show me the out put for part 3
#include
int main(void){ /** * An c-string array of size 100 named message is declared below */
char message[MAX_LIMIT];
//asking user to enter the message to encode
printf("Enter the message to encode "); fgets(message,MAX_LIMIT,stdin);
int i=0;
int length = strlen(message)-1; char cipher[length-1];
/*iterating through the string message character by * character in for loop */
printf(" ");
for(i = 0; i 0; j++){ bits[j] = temp % 2; temp = temp / 2; } bits[7] = 0; for(j = 7; j >= 0; j--){ printf("%d",bits[j]); } printf(" = %d ",value);
/* flip the bits and calculate the value */
j=0; int flag=0; for(j=0;j= 0; j--) { if (ones[j] == 1) twos[j] = 0; else { twos[j] = 1; break; } } int newValue=0; for(j=7;j>=0;j--){ newValue+=twos[j]*pow(2,7-j); } value=(-1)*newValue; } for(j = 0; j (3) The Nibble-Swap Cipher Copy your cipher2.c code to a file called cipher3.c and adjust cipher3.c so that it creates a cipher that takes each character of m and swaps the low 4 bits with the high 4 bits to get the cipher character. e.g., if m= "ABC", then the cipher is: "784", where is not displayable ... as follows: "A' = 0 1 0 0 0 0 0 1 'B' = 0 1 0 0 0 0 10 'C' = 0 1 0 0 0 0 1 1 0 0 0 10 100 = '0' 001 00100 = '$' 00110100 = '4'. Swap low 4 bits with high 4 bits Cipher is "$ 4" but it will display differently on the terminal window as $4 The code should create output that shows the binary representation of the characters and their ASCII codes and also shows the cipher characters in binary format and their ASCII codes. It should look as follows: (3) The Nibble-Swap Cipher Copy your cipher2.c code to a file called cipher3.c and adjust cipher3.c so that it creates a cipher that takes each character of m and swaps the low 4 bits with the high 4 bits to get the cipher character. e.g., if m= "ABC", then the cipher is: "784", where is not displayable ... as follows: "A' = 0 1 0 0 0 0 0 1 'B' = 0 1 0 0 0 0 10 'C' = 0 1 0 0 0 0 1 1 0 0 0 10 100 = '0' 001 00100 = '$' 00110100 = '4'. Swap low 4 bits with high 4 bits Cipher is "$ 4" but it will display differently on the terminal window as $4 The code should create output that shows the binary representation of the characters and their ASCII codes and also shows the cipher characters in binary format and their ASCII codes. It should look as follows
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started