C++ Character Set

Character set is a set of valid characters that a language can recognise. A character represents any letter, digits, or any other sign.

C++ has the following character set :

  • Letters : A-Z, a-z
  • Digits : 0-9
  • Special Symbols : Space + - ∗ ⁄ ^ \ ( ) [ ] { } = != < > . ′ ″ $ , ; : % ! & _ # <= >= @
  • White Spaces : Blank space, Horizontal tab (→), Carriage return (↵), Newline, Form feed
  • Other Characters : C++ can process any of the 256 ASCII characters as data or as literals.

C++ Character Set Example

Following C++ program gives you an idea about using of character set in C++ programming language :

/* C++ Character Set Example */

#include<iostream.h>
#include<conio.h>
void main()
{
   clrscr();
   char letter, digit, special, white;

   cout<<"Enter a Letter : ";
   cin>>letter;
   cout<<"You entered a letter '"<<letter<<"'"<<"\n";

   cout<<"Enter a Digit : ";
   cin>>digit;
   cout<<"You entered a digit '"<<digit<<"'"<<"\n";

   cout<<"Enter a special character : ";
   cin>>special;
   cout<<"You entered a special character '"<<special<<"'"<<"\n";

   cout<<"A horizontal(\t) tab";

   getch();
}

When the above C++ program is compile and executed, it will produce the following output:

C++ character set

More Example

Here are some C++ example programs listed, that you can go for:

C++ Online Test


« Previous Tutorial Next Tutorial »

Like/Share Us on Facebook 😋