GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • CODESCRACKER
  • Python
  • Java
  • C++
  • JavaScript
  • SQL
  • Quiz
  • C
  • C#
  • HTML
  • CSS
  • PHP
  • Networking
  • Operating System

This view

  • Original page
  • New address

GeezerVison is showing codescracker.com — C++ Character Set

  • C++ Course Basics
  • C++ Tutorial
  • C++ Basic Syntax
  • C++ Identifiers
  • C++ Character Set
  • C++ Input/Output Operator
  • C++ Variables
  • C++ Data Types
  • C++ Formatting Output
  • C++ Operators
  • C++ Assignment Operator
  • C++ Type Conversion
  • C++ Program Control
  • C++ if and if-else
  • C++ switch
  • C++ loops
  • C++ break and continue
  • C++ Functions
  • C++ Functions
  • C++ Prototype and Definition
  • C++ Function Call
  • C++ Function Types
  • C++ Friend Function
  • C++ Function Overloading
  • C++ Arrays and Strings
  • C++ Arrays
  • C++ One-Dimensional Arrays
  • C++ Strings
  • C++ String Functions
  • C++ Structures
  • C++ Structures
  • C++ Nested Structure
  • C++ Structure Array
  • C++ Pass Structure to Function
  • C++ Pointers
  • C++ Pointers
  • C++ Memory Map
  • C++ Declare Initialize Pointers
  • C++ Pointers and Structures
  • C++ Object-Oriented
  • C++ Object-Oriented
  • C++ Classes and Objects
  • C++ Constructors and Destructors
  • C++ Objects as Function Arguments
  • C++ Pointers and Objects
  • C++ Data Structure
  • C++ Linked List
  • C++ Stack
  • C++ Queues
  • C++ File Handling
  • C++ File Handling
  • C++ Opening and Closing Files
  • C++ Steps to Process Files
  • C++ Sequential I/O Operations
  • C++ Detecting EOF
  • C++ File Pointers Random Access
  • C++ Binary Files Operations
  • C++ Error Handling
  • C++ Misc
  • C++ typedef
  • C++ #define
  • C++ Date and Time
  • C++ Examples
  • C++ Examples

C++ Character Set

In this article, you will gain a basic understanding of the topic "character set in C++," along with an illustration of its use. Therefore, let's not waste any more time and get right down to its concise introduction.

Introduction to character sets

A character set is a collection of typographically correct symbols that are usable within a specific language. A letter, a digit, or any other sign can be represented by something called a character.

C++ has the following character set:

  • Letters: A-Z, a-z
  • Digits: 0-9
  • Special symbols: +, *, /, ^, \, (, ), [, ], {, }, =, !=, <, >, ', ", $, ;, :, %, !, &, _, #, <=, >=, @
  • White spaces: blank space, horizontal tab, carriage return, newline, form feed

Above are the list of character set, which are used most of the time, specially the first two which are "letters" and "digits". However, C++ can process any of the 256 ASCII characters as data or as literals.

Note that the term "literals" refers to the character or group of characters (word) that is used to describe the value that is used in the program. Thank you for your attention to this matter. If the values that they store do not change, literals are also referred to as variables. To put it another way, literals are unable to be changed, whereas variables can. When referring to a value as mutable rather than immutable, we are able to make adjustments to it or bring it up to date.

C++ Character Set Example

The following C++ program will provide you with an example of how character sets can be used in the C++ programming language:

#include<iostream>
using namespace std;
int main()
{
   char letter, digit, special;

   cout<<"Enter a letter: ";
   cin>>letter;
   cout<<"You entered a letter: "<<letter<<endl;

   cout<<"\nEnter a digit: ";
   cin>>digit;
   cout<<"You entered a digit: "<<digit<<endl;

   cout<<"\nEnter a special character: ";
   cin>>special;
   cout<<"You entered a special character: "<<special<<endl;

   return 0;
}

Following is an example of the output that will be generated by the aforementioned C++ program when it is compiled and run:

C++ character set

Now supply the inputs one by one and hit the "ENTER" key. For example, type "c" as a letter and then hit the "ENTER" key; then type "3" as a digit and hit the "ENTER" key again; finally, type "]" as a special character and hit the "ENTER" key a third time. For your understanding, I included the following snapshot after doing the same.

c++ character set example

More Examples

Here are some C++ programs that you might enjoy:

  • Add two numbers in C++
  • Check the Even or Odd in C++
  • Check whether a number is prime or not in C++
  • Check vowel or not in C++
  • Check if it's a leap year or not in C++

C++ Quiz


« Previous Tutorial Next Tutorial »
Practice Quizzes

Test your programming and computer science knowledge with interactive MCQs and topic-based quizzes.

All Quizzes SQL Quiz Python Quiz Java Quiz C++ Quiz
Popular Topics

Explore the most popular programming and computer science tutorials on CodesCracker.

Python Tutorial Java Tutorial C++ Tutorial SQL Tutorial JavaScript Tutorial HTML Tutorial CSS Tutorial Computer Networking
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.