dimanche 24 mai 2015

Randomly pairing two characters in a String

here I am making a program in which you write text and then it coverts it into another text, changing the characters and converts it back. For example, if you give that program let's say "hello world", it will make it something like

" }j!!& .&o!n "

, in which
} = h;
e = j;
l = !;
o = &;
w = .;
r = o;
d = n

So what i need to do is to pair 2 characters (I have a class which stores 2 chars) randomly from a string which includes all the characters twice and removing the paired characters from the string (I mean a string which has all the characters repeating 2 times like "abcdefg... abcdefg").

PS the paired characters should be removed to avoid repeating a character two times in my pairs. So if for example A and % characters are paired, A or % cannot be in other pairs too.




Aucun commentaire:

Enregistrer un commentaire