Switch to full style
C++ code examples
Post a reply

Character Operations

Thu Nov 13, 2008 2:19 pm

Characters in C are really just small integers, applying characters operations on C++
cpp 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)




Post a reply
  Related Posts  to : Character Operations
 character recognition     -  
 ANSI code value of character     -  
 Reading a Specific Character in php     -  
 Sending One lakh character in ajax     -  
 Find occurrences of each character in a string     -  
 character running automatically / jump /duck/ functions     -  
 Handle Key event-keyboard-Get typed Character and its code     -  
 Matrix Operations     -  
 Operations on Sucxent++     -  
 C++ Boolean Operations     -  

Topic Tags

C++ Variables