-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path018DecryptText.cpp
51 lines (41 loc) · 951 Bytes
/
018DecryptText.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <iostream>
#include <string>
using namespace std;
string ReadText()
{
string txt = "";
cout << " Enter Text " << endl;
cin >> txt;
return txt;
}
string Encrypt(string txt)
{
short length = txt.length() - 1;
string sum = " ";
for (short i = 0; i <= length; i++)
{
char entype = txt[i] + 2;
sum = sum + entype;
}
return sum;
}
string Decrypt(string Encrypt)
{
short length = Encrypt.length() - 1;
string Sum = " ";
for (short i = 0; i <= length; i++)
{
char Detype = Encrypt[i] - 2;
Sum = Sum + Detype;
}
return Sum;
}
int main(int argc, char const *argv[])
{
string Text = ReadText();
string Encrypttions = Encrypt(Text);
cout << " Text Before Encryption " << Text << endl;
cout << " Text After Encryption " << Encrypt(Text) << endl;
cout << " Text After Encryption " << Decrypt(Encrypttions) << endl;
return 0;
}