Question
Write a function encrypt that takes two strings s1 and s2 and an integer shift as parameters. Your function encrypts s1 and stores it in
Write a function encrypt that takes two strings s1 and s2 and an integer shift as parameters. Your function encrypts s1 and stores it in s2. The encryption is done by shifting each character shift number of places. For example if shift is 4, then every A in the s1 becomes E in s2, and B becomes F and so on. Z becomes the character Z + 4 which is ^ according to the ASCII table. Write another similar function decrypt (that takes two strings s1 and s2 and an integer shift as parameters) and decrypts s1 by shifting its characters back shift places and storing it in s2. Both functions should take s1 and s2 as char * as two parameters (pointer to char) plus the shift parameter as int. Write a program encryption.c whose main procedure reads a sentence from the user and encrypts it then decrypts it. Specifically, your program should ask the user Enter the text to encrypt. Then, it asks Enter the shift amount. After calling encrypt(origText, encText, shift), the main procedure outputs Encrypted: followed by the encrypted string. Then, after calling decrypt(encText, decText, shift), the main procedure outputs Decrypted: followed by the decText string. String comparison Write a program compare.c that reads two strings from command line arguments (hint: argc and argv) and outputs using printf whether one is the reverse of the other while ignoring the case. If the user does not run the program with the correct number of parameters, the program should output an error. Sample runs of the program are as follows: >compare Olla allo The strings are the reverse of each other >compare CAT tac The strings are the reverse of each other >compare Dog dragon The strings are not the reverse of each other >compare fog You must enter two words for comparison. Please try again. Make sure your code is properly indented, your variables have meaningful names, and macro definitions are used when appropriate.? program to be done in c language
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