Introduction To Character Sets
The C++ character set comprises alphabets, special symbols, digits, and whitespace characters that are recognized and accepted by C++ programs. These elements are utilized to form commands, expressions, identifiers, and other language constructs within C++.
In addition to standard characters, C++ also employs special character combinations to represent particular conditions. For instance, '\n' denotes a newline, '\b' represents a backspace, and '\t' signifies a horizontal tab.
The character set in C++ can be broadly categorized into four groups:
- Letters: Alphabets from A-Z and a-z. Note that uppercase and lowercase letters are distinct in C++.
- Digits: Numeric digits from 0 to 9.
- Special Symbols: Various symbols such as +, -, *, /, %, ^, &, |, ~, !,
<
, >, =, ( ), [, ], , ;, :, ,, ., ?, ', ", , #, $, @, etc. - Whitespace: Blank space, horizontal tab, carriage return, newline.
Example of C++ Character Set Usage
Below is an example C++ program demonstrating the use of character sets:
Output:-
This program allows the user to input a letter, a digit, and a special character, demonstrating the utilization of various elements from the C++ character set.
Last updated on -