SHOW:
|
|
- or go back to the newest paste.
| 1 | // | |
| 2 | // caesarCipher.cpp | |
| 3 | // Created by David on 4/13/12 | |
| 4 | // Copyright 2013 TTU. All rights reserved. | |
| 5 | ||
| 6 | #include <iostream> | |
| 7 | #include <string> | |
| 8 | ||
| 9 | using namespace std; | |
| 10 | ||
| 11 | int main() | |
| 12 | {
| |
| 13 | string input; | |
| 14 | int count = 0, length; | |
| 15 | ||
| 16 | cout << "Enter your phrase: \n"; | |
| 17 | getline(cin, input); | |
| 18 | ||
| 19 | length = (int)input.length(); | |
| 20 | ||
| 21 | for (count = 0; count < length; count++) | |
| 22 | {
| |
| 23 | if (isalpha(input[count])) | |
| 24 | {
| |
| 25 | input[count] = tolower(input[count]); | |
| 26 | for (int i = 0; i < 13; i++) | |
| 27 | {
| |
| 28 | if (input[count] == 'z') | |
| 29 | input[count] = 'a'; | |
| 30 | else | |
| 31 | input[count]++; | |
| 32 | } | |
| 33 | } | |
| 34 | } | |
| 35 | ||
| 36 | - | cout << "Results: \n" |
| 36 | + | cout << "Results: \n"; |
| 37 | ||
| 38 | } |