Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone help me figure out the code and find the best way to solve it ? #include #include cipher . h / / the

Can someone help me figure out the code and find the best way to solve it?
#include
#include cipher.h
//the code below is shown only to get started
int main(void)
// string with initialization
char alphabet[]= ZYXWVUTSRQPONMLKJIHGFEDCBA ;
//array declaration to hold a string
//(of up to 225 characters, plus \0 character)
char input[256];
char output[256]
//print the alphabet
//we demarcate the string with quotation marks so space at
// the start or end can be distinguished more clearly
printf(
This is the alphabet: \%s\
, alphabet);
//get input for the user
//we demarcate the string with quotation marks so space at
//the start or end can be distinguished more clearly
printf(
This is the alphabet: \%s\
, alphabet);
// get input fo the user
//the scanf formatting read a string, including
//the blank space before the %, would clear the buffer first
printf(
enter a string:);
scanf(%[^
]s, input);
printf( The string you entered was: %s\
, input);
//Examples; they are commented out since the functions are not implemented yet. They are included here to illustrate the function arguments and their use.
Substitution cipher: Encrypt the string input and put the result in output and put the result in output. Use alphabet as the key.
cipher_substitution(input, output, alphabet, ENCRYPT);
Enigma cipher: Encrypt the string input and put the result in output. The key is 1304.
cipher_enigma(input,output,1304,ENCRYPT);
}
As you create the library for ciphers.h, this format will help
//constant. Do not modify these.
#define ENCRYPT 1
#define DECRYPT 0
//write you function prototype declarations here for the following functions. Do not include the declarations of any other helper functions you may create.
string_length
index_of_char
cipher_substitution
cipher_enigma
Thank you!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions