Question
//part 1 code please include an output and a picture of the code also the code as text #include #include #include #define MAX_LIMIT 100 int
//part 1 code please include an output and a picture of the code also the code as text
#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 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 = "BStep 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