In c language please. Also comment what most of the code does Goal of this assig
ID: 3815328 • Letter: I
Question
In c language please. Also comment what most of the code does Goal of this assignment: To be able to 1) work with strings, 2) work with functions, 3) write pseudocode 5) translate pseudocode to C program, and 6)test programs thoroughly. Introduction Cryptography is the science of making messages secure, of transforming readable messages into unreadable messages and back again. Messages that are unreadable are called ciphertext. The process of turning plaintext into ciphertext is called encryption. The reverse process of turning ciphertext into plaintext is called decryption. One of the easiest ways to encrypt a message is to scramble the letters. For example the word "apple" could be randomly transformed to "lapep" In fact there are 120 different possible arrangements of the word "apple." However, if the encryption algorithm randomly scrambles the letters, the task of the decryption algorithm is pretty hard. Encryption and decryption algorithms must work together in some agreed upon way, with the encryption algorithm scrambling letters and the decryption algorithm unscrambling them. A transposition cipher is one way to scramble the letters of a message. The cipher separates the message into two groups of characters: the first group composed of the even-numbered characters and the second group composed of the odd-numbered characters. To produce the ciphertext, the cipher puts together both groups; placing the group of the even-numbered characters first, followed by the group of odd-numbered characters. This encryption results in a string with the characters shuffled to new positions. Project: Ask user to enter a string, write a function that takes the string as a parameter, encrypt the message as described above and returns the ciphertext. Then ask user again if she/he wants to continue or not. Finally print all the original messages in alphabetically ascending order. Example: Please enter a message: Fight, Matadors, for Tech! The encrypted message is: ih, Mtdr, frTc! Fgt aaos o eh Do you want to continue (Y/N)? Y Please enter a message: Bear our banners far and wide. The encrypted message is: erorbnesfradwd.Ba u anr a n ie The original messages in alphabetical order are: Bear our banners far and wide Fight, Matadors for Tech! String functions: Design your solution to use the string library functions. You must be able to incorporate the use of strien() (to check length of the message string), strcat() (to concatenate the even and odd characters string) and strcmp[] (for final alphabetical order) into the solution.Explanation / Answer
#include #include #include void main(){ charstring[50],tmp[50]; int spcnt[50],i,j,c; clrscr(); printf("Enter a string : "); gets(string); //encode logicfor(i=0;string[i];i++){ string[i]=string[i]+3; } textcolor(GREEN); printf(" "); cprintf("Encoded string is as follow : %s",string); //decompressed logicfor(i=0;string[i];i++){ string[i]=string[i]-3; } textcolor(GREEN); printf(" "); cprintf("De-Encoded string is as follow : %s",string); getch(); }Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.