cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
Capital and lower case letters
Capital and lower case letters
Mar 27, 2013 at 12:09pm UTC
tcan618
(38)
Hello!
How can I write program that can convert an input string into a form that only the first letter of the string is a capital letter and the rest is lower-case?
Last edited on
Mar 31, 2013 at 3:12pm UTC
Mar 27, 2013 at 12:47pm UTC
tath
(408)
single letter is a char type. Char is simply a 8 bit number (byte).
Each sign have it's code.
'a' is 97, and 'A' is 65.
more here
http://www.ascii-code.com/.
so to convert 'a' to 'A'.
1
2
3
4
5
6
char
c=
'a'
if
(c == 97) { c -= 32; }
Do you see what you need to do now? :)
Last edited on
Mar 27, 2013 at 12:51pm UTC
Mar 27, 2013 at 1:21pm UTC
MiiNiPaa
(8886)
http://cplusplus.com/reference/cctype/tolower/
http://cplusplus.com/reference/cctype/toupper/
Mar 27, 2013 at 1:24pm UTC
tcan618
(38)
I certainly see..
Topic archived. No new replies allowed.