Introduction to Programming in C++

C++ is Object oriented programing language. It was developed at AT & T Bell laboratories in the early 1980 in USA by Bjarne stroustrup. C++ derived from the C language . The most important elements added to C to create C++ are concerned with Class and Object. Since the Class was a major addition to the original C language.

c++ Introduction, Cpp Introduction, Cpp Keywords, charecter set, token

 

C++ Character Set

Letters: A-Z, a-z 
Digits: 0-9
Special Symbols: Space + - * / % ^ \ () [] {} =! < >. " $ , ; : & ? _ # @
White Spaces: Blank Spaces, New Lines, Tabs
Other Characters: Any of the 256 ASCII Characters
 

Token

The smallest individual unit in a program is known as token. Tokens used in C++ are: Keywords, Identifiers, Constants, Operators
 
Keyword:  Keywords are reserve words that have some meaning and these meanings can not be changed. All keywords must be written in lowercase.
Cpp Keywords list

 
 
Identifier: Identifiers are user-defined names of variables, functions and arrays.
     Rules for Identifiers
1) 1st character must be an alphabet or underscore.
2)  Must consist of only letters, digits, or underscore.
3)  Cannot use a keyword.
4)  Must not contain white space. 
 

Constant: Constants are the fixed values that do not change during the execution of a program. 

 i) Integer Constant :- The numbers which has not any fractional part.

Ex : 20, -65, 256, 50 etc.

ii) Floating Point Constant :- The numbers which has integer part as well as fractional part.

Ex:- 12.5, -2.6, 0.65, 0.0 etc.

iii) Character Constant :- A character constant is a single alphabet, a single digit or a single special symbol enclosed within pair of single quotes. 

Ex :- 'a', '5', '?', '#' etc.

iv) String Constant :- A string constant is a character or group (sequence) of characters enclosed within pair of double quotes.
Ex:- "a", "5", "ab", "54", "?", "Hello", "Today is Monday" etc.

v) Backslash Character Constant :- These are used in output functions.

 

        '\a'    -    Alert or Alarm or Bell

        '\b'    -    Backspace

        '\f'     -    Form feed

        '\n'    -    New Line

        '\r'    -    Carriage return

        '\t'    -    Horizontal Tab

        '\v'    -    Vertical Tab

        '\''    -    Single Quote

        '\"'    -    Double Quote

        '\?'    -    Question Mark

        '\\'    -    Backslash    

        '\0'    -    Null

Const: A const keyword is used to define a constant that value can not be changed.

Ex: const float pi=3.14;

Operators :- Operator is a symbol that is used to perform some mathematical and logical operations.

EX: +, -, *, /, <, > etc.

0 Comments:

Post a Comment

If you have any queries or suggestions, please let me know!