Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void fWrite(string strEncrypted);
- string fRetrieve();
- string fEncrypt(string strInput);
- void main()
- {
- string TEMP;
- string strEncrypted;
- string strInput;
- cin >> strInput;
- strEncrypted = fEncrypt(strInput);
- cout << strEncrypted << endl;
- fWrite(strEncrypted);
- TEMP = fRetrieve();
- cin >> TEMP;
- return;
- };
- string fEncrypt(string strInput)
- {
- int nLen = (strInput.length());
- for(int nPos = 0; nPos < nLen; nPos++)
- {
- strInput[nPos]=(((strInput[nPos])+(nPos+1))*2);
- };
- return strInput;
- };
- void fWrite(string strWrite)
- {
- ofstream filePassword;
- filePassword.open("password.txt");
- filePassword << strWrite;
- filePassword.close();
- return;
- };
- string fRetrieve()
- {
- string strPassword;
- ifstream filePassword("password.txt");
- filePassword >> strPassword;
- //Decrypt the string
- int nLen = (strPassword.length());
- for(int nPos = 0; nPos < nLen; nPos++)
- {
- strPassword[nPos]=(((strPassword[nPos])-(nPos+1))/2);
- };
- cout << strPassword;
- return strPassword;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement