Computer Science > LECTURE SLIDES/NOTES > University of Michigan - EECS 183ciphers (All)
/** * ciphers.cpp * * Hadianto Leonard & Tian You Guo * leonhadi & kevinguo * * EECS 183: Project 3 * * <#description#> */ #include "caesar.h" #include "vigenere.h" #include "polybius.h" ... #include <iostream> #include <string> using namespace std; int main() { string cipherInput; string encrypt; string message; string key; int keynum; bool flag; char grid [SIZE][SIZE]; //ask user to choose between Caesar,Vigenere, or Polybius) cout << "Choose a cipher (Caesar, Vigenere, or Polybius): "; // used getline to get the entire line, and make it uppercase getline(cin, cipherInput); cipherInput = toUpperCase(cipherInput); if (cipherInput == "CAESAR" || cipherInput == "C") { // ask if user want to encrypt or decrypt, getline to avoid conflict and make it uppercase cout << "Encrypt or decrypt: "; getline(cin,encrypt); encrypt = toUpperCase(encrypt); // set flag to true if user want to encrypt and flag to false if user want to decrypt if(encrypt == "ENCRYPT" || encrypt == "E") { flag = true; } else if (encrypt == "DECRYPT" || encrypt == "D") { flag = false; } // if it's not either print invalid mode and exit program else { cout << "Invalid mode!"; return 0; } // get message from user cout << "Enter a message: "; getline(cin,message); // get the key cout << "What is your key: "; cin >> keynum; [Show More]
Last updated: 2 years ago
Preview 1 out of 4 pages
Buy this document to get the full access instantly
Instant Download Access after purchase
Buy NowInstant download
We Accept:
Can't find what you want? Try our AI powered Search
Connected school, study & course
About the document
Uploaded On
Mar 23, 2021
Number of pages
4
Written in
This document has been written for:
Uploaded
Mar 23, 2021
Downloads
2
Views
330
In Scholarfriends, a student can earn by offering help to other student. Students can help other students with materials by upploading their notes and earn money.
We're available through e-mail, Twitter, Facebook, and live chat.
FAQ
Questions? Leave a message!
Copyright © Scholarfriends · High quality services·