-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathCipher.cpp
More file actions
37 lines (32 loc) · 761 Bytes
/
Cipher.cpp
File metadata and controls
37 lines (32 loc) · 761 Bytes
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
//The code will encrypt your message..
#include <iostream>
#include <string>
using namespace std;
int main()
{
string input;
int count, length;
cout << "Enter The Phrase: ";
getline(cin, input);
length = (int)input.length();
for (count = 0; count < length; count++)
{
if (isalpha(input[count]))
{
input[count]=tolower(input[count]);
for (int i = 0; i < 5; i++)
{
if ((input[count])=='z')
{
input[count] = 'a';
}
else
{
input[count]++;
}
}
}
}
cout<<"Encoded text= "<<input<<endl;
return 0;
}