Joined: Sun May 25, 2008 5:34 pm Posts: 95 Has thanked: 2 time Have thanks: 1 time
Characters in C are really just small integers.
Code:
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)