SQL

Friday, 29 January 2016

Encrypt a String using Vector in C++

This application will Encrypt any message as an reverse format. As an example:
a --> z
b --> y

.....

Capital Letter was not in consideration. You have the idea to do it :D

It is always a good idea to see if the idea is working or not. So let's try the methodology first. If it works then we will start coding.



hasan@lucid:~/Desktop/cpp/vector$g++ -std=c++14 encrypt.cpp
hasan@lucid:~/Desktop/cpp/vector$ ./a.out
a-->z
b-->y
c-->x
d-->w
e-->v
f-->u
g-->t
h-->s
i-->r
j-->q
k-->p
l-->o
m-->n
n-->m
o-->l
p-->k
q-->j
r-->i
s-->h
t-->g
u-->f
v-->e
w-->d
x-->c
y-->b
z-->a


Now we can proceed to actual code to encrypt a message or string.




hasan@lucid:~/Desktop/cpp/vector$g++ -std=c++11 encrypt.cpp
hasan@lucid:~/Desktop/cpp/vector$ ./a.out
--- --- -- -----
blf ziv zm rwrlg

Post a Comment