for(int i = 0; int let = tolower(str[i]); ++i) ...
switch(int key = ...) ...
if(FILE* fp = fopen(...)) ...
...

とか使いますか?