User Menu

Login



Share with

Introduction to C++ PDF Print E-mail

Introduction to C++

C++ is a general purpose programming language invented in the early 1980s by Bjarne Stroustrup at Bell Labs. 

In fact C++ was originally called C with Classes and is so compatible with C that it probably compile more than 99% of C programs without even changing a line of source code. 

How do I get started with C++?

First you need a C++ compiler. There are many commercial and free ones available. All compilers listed below are completely free and include an IDE for you to edit, compile and debug your program.

  • Download and Install Borland's Turbo C++ Compiler.
  • Download and Install Bloodshed Dev C++ Open source Compiler

 

click here to see the Instructions for Downloading and Installing Borland C++ Compiler 5.5
C++ character set

 

C++ is a case sensitive language means C++ treats a-z different from A-Z i.e in C++ "ram" is different from "RAM".Most of the programming in C++ is done with small alphabets i.e a-z.

The following chart contains all 128 ASCII decimal (dec), octal (oct), hexadecimal (hex) and character (ch) codes of C++ supported characters.

ascii chart

C++ keywords

Chart of reserved keywords in C++. Since they are used by the language, these keywords are not available for re-definition.

kewords

 

Identifiers

The name of a variable (or other item you might define in a program) is called an identifier. A C++ identifier must start with either a letter or the underscore symbol, and all the rest of the characters must be letters, digits, or the underscore symbol. Some of the valid and Invalid identifiers of c++ are

Literals/Constants in C++

Invalid Identifiers

MY Name  

1MY

%my

Valid Identifiers

MY_NAME

MY1

_my

Literals are the most obvious kind of constants. They are used to express particular values within the source code of a program. when we write:

a = 5;

the 5 in this piece of code is a literal constant.

Literal constants can be divided in Integer Numerals, Floating-Point Numerals, Characters, Strings and Boolean Values.

  1.  integer-constant
  2. character-constant
  3. floating-constant
  4. string-literal
  5. Boolean-literal

Examples of different

157 // integer constant
'A' // character constant
0.2 // floating constant
0.2E-01 // floating constant
"Ayan" // string literal

There are only two valid Boolean values: true and false. These can be expressed in C++ as values of type bool by using the Boolean literals true and false.

Escape Characters in C++

Chart of C++ Escape Characters Set

 

 escapecharacters

scroll back to top