sprintcar
Mechanical
- Oct 16, 2001
- 763
Taking c++ class at nite. Program encrypts text file by offsetting char by some integer. 2nd program reverses by same value to original text. Runs fine. Instructor (another engineer) wants to decode a text file w/ unknown integer value offset. I did one that searches +/- 30 integers with cout<< for user to review.
Assuming its predominately letters (cap and lower case) could you count the occurences of each char, take the ASCII value of the one with max value, set it to 'e'. This offset value would then be applied to the text file and cout<< the text for user approval? There's a letter use hierarchy in English that would apply. Seems like a LOT of Code.
Anybody have a shortcut? Thanks!! (this is an extra credit and boy, do I need it!)
Assuming its predominately letters (cap and lower case) could you count the occurences of each char, take the ASCII value of the one with max value, set it to 'e'. This offset value would then be applied to the text file and cout<< the text for user approval? There's a letter use hierarchy in English that would apply. Seems like a LOT of Code.
Anybody have a shortcut? Thanks!! (this is an extra credit and boy, do I need it!)