C++ Encryptor/Decryptor Problem

:D Hello again,

I am making a console app in Dev C++ where text can be encrypted and the encryption is saved to a single string. The encryptor is a simple substitution one, and here is my problem:

a = 35
b = 3
c = 5

If "abc" is to be encrypted it would look like "3535" (saved to one string) ,but how would the application know if its 35-3-5 or 3-5-35 or 3-5-3-5 ?

I would appreciate any help,

Muhasaresa
If "abc" is to be encrypted it would look like "3535" (saved to one string) ,but how would the application know if its 35-3-5 or 3-5-35 or 3-5-3-5 ?

It wouldn't. You'll have to use a fixed length (adding zeroes where necessary) or separate them with spaces or another character.

Also: http://www.cplusplus.com/articles/36vU7k9E/
Or use non ambiguous codes. By instance http://en.wikipedia.org/wiki/Huffman_coding
Thanks :D
Topic archived. No new replies allowed.