Lecture: Strings 8: The Caesar Cipher Revisited
Objective: Build on the Strings 8 lecture final code to implement a complete Caesar Cipher program
Problem 1 – Generate a complete Caesar Cipher solution
Download the Graded Exercise 11 Materials zip file and unzip it somewhere on your computer.
Create a new C project named whatever you want in Visual Studio using the Windows Desktop Wizard or in Xcode.
If you're using Visual Studio, add the main.c file from the materials zip file to your project. If you’re using Xcode, Xcode automatically generates a main.c file for you; copy and paste the contents of the main.c file from the materials zip file over the one in your Xcode project.
Read in user input for whether they want to left (l) or right (r) shift and loop while they enter an invalid response; don't prompt for the user input, and don't print the typical "invalid range" message when they enter an invalid score, because that will confuse the automated grader. Remember to use thegetcharfunction like we did in the If Statements exercise.
Read in how many characters the user wants to shift, 1 to 25, and loop while they enter an invalid response; don't prompt for the user input, and don't print the typical "invalid range" message when they enter an invalid score, because that will confuse the automated grader.
Change the encryption and decryption code to shift in the appropriate direction by the appropriate amount based on the user responses above.
The image below shows my output when I enter z, Q, r, 0, 26, 1, bob, BOB; make sure you get the exact same output when you provide the same inputs.
Submitting Your Solution
Click on the gray box below that says Load Graded Exercise 11: Full Caesar Cipher in a new window.
Click on the link for this graded assignment from the list of Live Coursework and click the green Submit button under Actions on the left on the assignment page. Upload your main.c file by clicking the Choose File button and navigating to it or by dragging that file onto the upload box. Click the green Submit button on the bottom right of the dialog box.
Once the test case(s) for the assignment have been run (which typically happens pretty quickly), you can check your results for each test case and your overall score at the top right of the Test Cases section. If you’re happy with your results, you’re done.
If you need (or want) to improve your score, you can look at the test case results, modify your code as appropriate, and resubmit again. If you click on a specific test case, you can get additional information about the output generated by your submission, the expected output for a correct submission, and the difference between the two outputs (in the Pretty Diff section at the bottom of the dialog box).
All assignments in the course are set for unlimited submissions, so you can resubmit as many times as you want until the due date/time. The grade you’ll receive for the assignment will be the highest grade you achieved across all your submissions for the assignment.
This tool needs to be loaded in a new browser windowLoad Graded Exercise 11: Full Caesar Cipher in a new window