Can someone create a C++ program for me that will convert lowercase letters to uppercase letters and will stop when the user inputs a non-lowercase character? I'd like it to be simple and only use iostream as the header file. Please, no if statements, just a while loops, cout, cin, endl, and proper syntax. Thnx!
Lowercase to Uppercase C++ program?
use toupper,tolower,isalpha functions
Reply:What for? C has built-in funtions do that.
Reply:I'll let you do your own homework, but I'll give you a hint. A character is really just an int. The mapping of characters to their numeric ASCII values is well defined. Capital A=65, B=66, all the way to Z=90. Lower case letters are a=97 to z=122. Converting a lowercase letter to its uppercase counterpart can be simply a matter of subtraction.
Here's a link to an ascii chart, but I'm sure your text book has one. http://www.asciitable.com/
garland flower
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment