Question: #include #include #include #define MAX_LIMIT 100 int main(void){ /** * An c-string array of size 100 named message is declared below */ char message[MAX_LIMIT]; //asking

 #include #include #include #define MAX_LIMIT 100 int main(void){ /** * An

#include #include #include #define MAX_LIMIT 100

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 flipBits[8]; for(j = 0; j = 0; j--){ printf("%d", flipBits[j]); }

int newValue = -1 * (value+1); printf("=%d ",newValue); cipher[i] = (char)newValue; } printf("Cipher = \""); i = 0; for(i = 0; i

printf("\" "); return 0;

}

(2) The Bit-Reverse Cipher Copy your cipher1.c code to a file called cipher2.c and adjust cipher2.c so that it creates a cipher that takes each character of m and reverses the bits to get the cipher character. e.g., if m= "ABC", then the cipher is: "B"... 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 1|0|0|0|0|0|10 = '' 0[1|0|0|0|010 = 'B' 11|0|0|0|0|10 = 7. Reverse of above bits Cipher is "BT" but it will display differently on the terminal window as BO The code should create output that shows the binary representation of the characters and their ASCII codes and also show the cipher characters in binary format and their ASCII codes. It should look as follows: Enter the message to encode... ABC 01000001 = 65 10000010 = -126 01000010 = 66 01000010 = 66 01000011 = 67 11000010 = -62 Cipher = "B

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!