Say I have an array that counts the occurrences of letters read in from a .txt file: After I've determined the index value denotes the letter that occurs the most frequently, how do I use the information I have (an array full of integer values denoting a count and the fact that each index represents a number) to print out the name of the letter? Clearly I can't just say "cout << array[index];" because this only gives me an integer value.
Thanks
edit: is it as easy as: static_cast<char>(highest index) ?
I need to shift letters by some amount "shift" which I've found using previous code. Eg: shift = 3 means that 'e' should become 'b' and 'a' should become 'x'.
I think I can start to do this by saying something like
ch = static_cast<char>(ch-shift)
but I run into problems at my end cases because if i use the above arithmetic on 'a', then 'a' becomes something like'^'. I need my shifts to be confined to the number interval that contains the letters in ASCII
The shift will always be the same through the entire program, it wont always be three though. I don't think what you've written will work, unless I'm misunderstanding.
If I am shifting 3 to the left, IE 'a' needs to equal 'x' and 'b' needs to equal 'y', how does your code help me then?