// Basic Encryption / Decryption // By Ice_Dragon#include<iostream.h> int main() { int e; char str[50]; char ans; cout << "Please Enter The String To Encrypt:\n"; cout << "String: "; cin >> str; for(e=0;str[e]!='\0';e++) // Although this looks confusing, all it basically does is increases our strings ASCII code by 5, therefore scrambles it :) str[e]+=5; cout<<"\n\nYour Encrypted String Is:\n"; cout<<str; cout<<"\n\n\n"; cout << "Do You Wish To Decrypt This String? (y/n)\n"; // Asks the user whether they want to decrypt the encrypted string, cout << "Answer: "; cin >> ans; switch (ans) // Good example of a Switch statement, gets user input, and then basically, if the user types { // 'y' (yes) it then executes the first block of code, which decrypt's the string. // Or if the user inputs 'n' (no) - exits the application. case 'y': for(e=0;str[e]!='\0';e++) // Gets our encrypted string, which has been increased by +5 of the ASCII, and then -5's it, str[e]-=5; // Therefore giving us back our untampered string. cout <<"\n\nYour Decrypted String Is:\n\n"; cout <<str; cout << "\n\n"; break; case 'n': cout<<"\nExiting Application...\n\n"; return 0; } return 0; } /////////////////////////////////////////////////////////////////////////// // Very basic method of encryption, a little learning program for myself // Wouldnt reccomend encrypting your passwords with it hehe. // // Thanks; // Ice_Dragon // Ice_Dragon@raw-networks.com ///////////////////////////////////////////////////////////////////////////