EECS 183 Labs
EECS 183 Lab 10: Mini Ciphers
Lab due on your scheduled lab day (April 7 - 9)
Lab accepted for full credit until Monday, April 13 11:59 pm Eastern
Direct submission link
Build-and-submit lab (no starter files)
In this lab, you will create a small C++ project from scratch in your IDE (Xcode or Visual Studio) and implement a mini ciphers program for the Atbash cipher.
By completing this lab assignment, you will learn to:
- Create a multi-file C++ project without starter files.
- Use
#includewith your own header and implementation files. - Implement and call a cipher function that transforms alphabetic characters.
- Perform required input validation before running the cipher.
No Starter Files
There are no starter files for this lab. You must create your own project and files.
Required Files
Your submission must include:
- At least two
.cppfiles. - At least one
.hor.hppfile. - Each
.cppfile should contain at least one function definition. - Each header file (
.h/.hpp) should contain at least one function declaration or class declaration.
A typical, and recommended, structure is:
main.cppatbash.cppatbash.h
Program Requirements
Your program must:
- Print a short greeting.
- Prompt the user for a message.
- Use Atbash to encode the message.
- Only transform alphabetic letters (
A-Z,a-z). - Pass through all non-alphabetic characters unchanged.
- Print the encoded result.
Atbash Cipher Rules
Atbash replaces each letter with its mirror letter in the alphabet:
A<->ZB<->YC<->X- …
a<->zb<->yc<->x
Case must be preserved:
- Uppercase letters map to uppercase letters.
- Lowercase letters map to lowercase letters.
Any character that is not a letter should stay exactly the same (spaces, punctuation, digits, symbols).
NOTE: Atbash is its own inverse. Running Atbash twice returns the original message.
Error Handling Before Cipher
Before calling the cipher function, check whether the input message contains at least one alphabetic character. If it does not, print:
Error: message must contain at least one alphabetical character.
and do not run the cipher.
Sample Runs
When you run your program, it should behave per the examples below. Assume that the red text is what some user has typed.
NOTE: The following sample runs define the required output behavior used by the autograder tests.
Sample Run 1
Atbash Cipher Mini-Lab
Enter a message to encode: Hello, World!
Encoded message: Svool, Dliow!
Sample Run 2
Atbash Cipher Mini-Lab
Enter a message to encode: Svool, Dliow!
Encoded message: Hello, World!
Sample Run 3
Atbash Cipher Mini-Lab
Enter a message to encode: The grasshoppper lies heavy.
Encoded message: Gsv tizhhslkkkvi orvh svzeb.
Sample Run 4
Atbash Cipher Mini-Lab
Enter a message to encode: ZyGoMa
Encoded message: AbTlNz
Sample Run 5
Atbash Cipher Mini-Lab
Enter a message to encode: Chungus the squirrel is hungry
Encoded message: Xsfmtfh gsv hjfriivo rh sfmtib
Sample Run 6
Atbash Cipher Mini-Lab
Enter a message to encode: 183 !!!
Error: message must contain at least one alphabetical character.
IDE-Specific Setup Guides
Use one of the detailed setup pages: