|
-
May 20th, 2003, 09:54 PM
#1
Member
simple encryption decrption
i really hate c++ =p, but i am creating this program because of bordom, and to expand knowledge, i would like to know if anyone else can help with it, for some reason, its messed really bad,, or post some of your code for encryption too, anywho, this is really basic, just posting for fun, and it doesnt decrypt at all, but oh well
/*
Simple Encryption and Decryption
*/
#include <iostream.h>
int main()
{
char letter; // initial input
int temp; //random input for crypto
int i=0; // for counter and other counter
int p; // temp var for counting and storing letters in let[]
char let[100]; // storing words when encoded
cout << "Enter Random Number" << endl; //////////////////////
cin >> temp; // Simple input //
cout << "Enter Text To Be Encrypted" << endl; //////////////////////
for(p=0;letter != '5';p++) { // increases P everytime to keep up with letter does not equal 5
cin >> letter; // simple input
if('a' <= letter && letter <= 'z') { // if its not a and z it will quit
letter = (letter - temp); // changes each letter to create an different character per character
cout << letter;
letter = let[p]; // set p to hold all input into a string as the encoded format
}
}
cout << endl;
for(i=0;i!=5;i++) { // loop 5 times to show different combos
for(p=0;let[p] != '\n';p++) { //loop until end of line in array
cout << let[p];
}
}
return 0;
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|