char case change

I am having difficulty trying to change case for letters. I want my program to be able to accept a and A. I have gotten it to work with string before, but I am trying to use char now to change case. Any tips on the basics? I will post my code later if I'm still stuck, but maybe a good basic explanation will help me figure it out. Thanks!

p.s. : I am including <cctype> and <algorithm>. My problem seems to be with the 'transform' and class/struct/union portion of the code.

Last edited on
To go from upper to lower, you can subtract ('A'-'a') after checking that it is between 'A' and 'Z'. Similarly, you can add ('A'-'a') to go from lower to upper after checking that it is between 'a' and 'z'.
in the end I just used some if statements....it worked out more easily for the program I was doing... thanks though!
Topic archived. No new replies allowed.