I get line 38.
line 40. I want to assign UNUSED chars from reverse alphabet to a next character in alphabet.
So "i" is looping thru reverse alphabet, first true character(means is not used) will enter block and be assigned to next character in alphabet(loop above that) I know it seems confusing.
If I initialize array to false then to enter the loop I will need false value. I get logic but my logic is that if it is not been used it is true, once I use it I need to set it to false and next time I will not enter the loop if I have that character again.
The only thing about it, I still don't get you sample code for bool. What is it doing?
And is my code any good, is it doing anything and how can I check return(new code table with cout?)
Like I said, this is just part of the program, I will need to pass this new code table to another func, receive input file stream and then encrypt text.
I chose to call the array "used", because your function was already names "isUsed". If a character is not used, then the value is false. If a character is used, then the value is true. If you want to know if a character is not used, you can simply test:
if (! isUsed(used,c))
If you don't like that, change the name of the array to "not_used" and initialize it to true.
I still don't get you sample code for bool. What is it doing?
line 1: used is a 26 element array of bools initialized to false. One bool per letter of the alphabet (or reverseAlphabet, if you wish).
line 4: Tests the element of the array corresponding to currentC. The - 'a' subtracts the ASCII value of 'a' from currentC so that the index is 0 based. The assumption here is that when you use a letter from the alphabet, you set the corresponding element of used to true.