If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Enjoy an ad free experience by logging in. Not a member yet? Register.

ToUpper

I am trying to write a program, and I am using classes when doing it. My problem right now is I am using a class, and have gotten it setup to ask a question and take in a char. I was trying to use the toupper command to make the char uppercase. For some reason, it is not changing the character to uppercase. Please check out my code and see if you can tell what I am doing wrong. I am using the #include <cctype> header to get the toupper, but it is not changing it to uppercase. Please assist!

Found an answer to this one, but have another question to follow it up. The answer was to change my code a bit to
choice = toupper(choice);

My issue now is no matter what the answer is, the while loop still continues to run. When the choice answer is 'M', it should break the loop, but instead, it continues running. Is my logic wrong on this?

Users who have thanked sakai for this post:

Thanks!! I don't know what I was thinking. My logic was wrong when it came to this. It took me a few minutes of putting the statements together, and turning them into the logic statements to determine what I was doing wrong. Thanks for the help!! Sometimes its the most simplest of answers that cause the biggest issues.