Created
October 3, 2017 00:38
-
-
Save maxchehab/6e87d4dc8a498d6015ed297d246932d0 to your computer and use it in GitHub Desktop.
only works for capital letters. Look at an ascii table and modify if statement to make it work for lowercase.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstring> | |
#include <iostream> | |
#include <string> | |
using namespace std; | |
char input[80]; | |
int counter = 1; | |
string sInput; | |
int main() | |
{ | |
cin >> sInput; | |
if(sInput.length() > 80){ | |
cout << "Input is greater than 80 characters..." << endl; | |
return 0; | |
} | |
strcpy(input, sInput.c_str()); | |
for(int i = 0; i < sInput.length(); i++){ | |
if( input[i] >= 65 && input[i] <= 77){ | |
input[i] += 13; | |
}else if(input[i] >= 78 && input[i] <= 90){ | |
input[i] -= 13; | |
} | |
cout << input[i]; | |
} | |
cout << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment