The problem was that code[1] was only ever storing the most recent comparison result.
Imagine your string was: "aBc".
The first time through the loop, it sees 'a' is not upper-case, and sets code[1] to be 'F'.
The second time, it sees 'B' is upper-case, and sets code[1] to be 'T'.
The third time, it sees 'c' is lower-case, and sets code[1] to be 'F'.
The final value of code[1] is therefore 'F'.
If you used a debugger - or even just got your code to output some debugging information to stdout, you would have been able to see the changing value of code[1] for yourself, and seen what was happening.