Thu Nov 13, 2008 2:19 pm
char ch;
scanf("%c", &ch); Read the next character
ch = getchar(); Read the next character (plain C)
cin.get(ch) Read the next character
scanf(" %c", &ch); Read the next non-blank character
cin >> ch Read the next non-blank character
printf("%c", ch); Print a character
putchar(ch); Print a character (plain C)
cout << ch Print a character
ch + 5 Arithmetic on chars is okay.
ch - 'a' + 'A' Change case
#include <ctype.h>
#include <cctype>
isalpha(ch)
isupper(ch)
. . .
toupper(ch)
toascii(ch)
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.