Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please check it is 100% correct before sending me,thanks very much! Write a C program caesar.c which reads characters from its input and writes the
please check it is 100% correct before sending me,thanks very much!
Write a C program caesar.c which reads characters from its input and writes the characters to its output encrypted with a Caesar cipher. A Caesar cipher shifts each letter a certain number of positions in the alphabet. The number of positions to shift will be given to your program as a command line argument. Characters other than letters should not be encrypted. Your program should stop only at the end of input. Your program should contain at least one function other than main. For example: $ ./caesar 1 This life well it's slipping right through my hands Uijt mjgf xfmm ju't tmjqgjoh shiu uispvhi nz iboet These days turned out nothing like I had planned viftf ebzt uvsofe pvu opuijoh mjlf 3 ibe qmboofe Ctrl-D $ ./caesar 10 abcdefghijklmnopqrstuvwxyz klmnopqrstuvwxyzabcdefghij ABCDEFGHIJKLMNOPQRSTUVWXYZ KLMNOPQRSTUVWXYZABCDEFGHIJ Ctrl-D $ ./caesar -42 Control well it's slipping right through my hands Myxdbyv govv sd'c cvszzsxq bsard drbyear wi rkxnc These days? Droco nkic? Ctrl-D Hint: handle upper and lower case letters separately Hint: use % Hint: use atoi to convert the first command-line argument to an int. Hint:make sure you understand this example program which uses a atoi to convert command-line arguments to an ints. Hint: create a function with a prototype like this: int encrypt(int character, int shift); which returns the character shifted by the specified amount Manually Cracking a Caesar Cipher Here is some (New Zealand) English text that has been encrypted with a Caesar cipher. z uf dp drbvlg ze jfdvsfup vojv'j tri Nu fiuvi uzwwvivek uizebj rk kyv jrdv srij z befn rsflk nyrk pfl uzu reu z nreer jtivrd ky kilky Jyv kyzebj pfl cfmv kyv svrty, pfl'iv jlty r urde czri Use the program you have just written to discover the secret text? Hint: try different shifts until you see English. You program will only be tested with an appropriate command line argument - but a good programmer would check the command line argument is present and appropriateStep 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