Question: C Programming Create a function called printCipher() with a return type of void which takes an int and a _ Bool as parameters. Your function

C Programming

Create a function called printCipher() with a return type of void which takes an int and a _Bool as parameters. Your function declaration should look like:

 void printCipher(int, _Bool); 

Use a loop to display the alphabet in the proper case (the _Bool parameter). The _Bool parameter is set to 1 (true) to display lowercase letters and 0 (false) to display uppercase letters. On the next line, use a loop to display the shifted alphabet in the proper case. To perform the shift, add the shift value to the character (the int parameter). Example with a shift value of 3: A + 3 is D. The shift value can also be negative, shifting the other direction. Example with a shift value of -3: A - 3 is X. Be careful with characters at the beginning or end of the alphabet that wrap around. Note: you will need to support numbers larger than 25 (and smaller than -25).

Calling printCipher(3, 1) produces the output (shift 3, lower case):

abcdefghijklmnopqrstuvwxyz

defghijklmnopqrstuvwxyzabc

Calling printCipher(5, 0) produces the output (shift 5, upper case):

ABCDEFGHIJKLMNOPQRSTUVWXYZ

FGHIJKLMNOPQRSTUVWXYZABCDE

Calling printCipher(29, 1) produces the output (shift 29, lower case):

abcdefghijklmnopqrstuvwxyz

defghijklmnopqrstuvwxyzabc

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!