Generation

generate functionSun, 11 Dec 2022

A software house is looking for a programmer to write a program that does encryption and decryption of a message to securely transmit it over the network. Be the one who will write that program. Write a C program that takes a string as an input (including spaces). The string will be passed to a function named encrypt () as an argument. The function will encrypt the string and displays the encrypted version of the message. There should be another function named decrypt (), which will decrypt the message and displays the original message. Your program should be menu driven. Implement Caesar cipher algorithm in a way that each character in the original string should be replaced by its succeeding third letter.

#include<stdio.h> #include<string.h> void encrypt(char str[]) { int i; for(i=0;i<strlen(str);i++) { if(str[i]>='A' && str[i]<='Z') { if(str[i]=='Z') { str[i]='A'; } else { str[i]=str[i]+3; } } else if(str[i]>='a' && str[i]<='z') { if(str[i]=='z') { str[i]='a'; } else { str[i]=str[i]+3; } } } } void decrypt(char str[]) { int i; for(i=0;i<strlen(str);i++) { if(str[

Questions about programming?Chat with your personal AI assistant