Hi everyone
I have been trying to create a simple encryption program it will read the txt from a .txt and then if plaintext encrypt it or if encrypted decrypt it to plaintext using the caesar's cipher I just can't get my head around as I am only new to c++ programming
Any help or ideas would be great
Here's what I have so far:
Thanks in advanceCode:#include <iostream>//for input and output #include <fstream>// for working with files #define isupper(a) ((a)>= 'A' && (a)<= 'Z') #define islower(a) ((a)>= 'a' && (a)<= 'z') using namespace std; ifstream inFile; ofstream outFile; char PlainText[100], CipherText[100] ; int main() { { outFile.open("test.txt"); (!outFile.eof() << PlainText[100]); for ( int i = 0 ; PlainText[i] ; i++ ) { if ( isupper(PlainText[i]) ) CipherText[i] = 25 - (PlainText[i] - 'A') + 'A' ; else if ( islower(PlainText[i]) ) CipherText[i] = 25 - (PlainText[i] - 'a') + 'a' ; else CipherText[i] = PlainText[i] ; } outFile << CipherText << endl; } inFile.close(); system("pause"); return 0; }




Reply With Quote