I was looking through a few old programs I wrote, and I came across this Enigma cipher simulator. I was wondering if you could help me refactor the algorithm, as it doesn't seem to be the most efficient method.
Try this. I've basically kept your algorithm but tidyied it up a bit. It will now deal with non-uppercase and digits in the text. Lowercase are converted to uppercase and other chars are kept the same in the output. I've separated out the various encoding strings (Alphabet, Reflector, Plugboard) so that it is now easier to change them if required as they are not now buried in a class.
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.