1.1 INTRODUCTION ::
The C++ programming language was developed at AT&T Bell Laboratories in the early 1980s by Bjarne Stroustrup. He found 'C' lacking for simulations and decided to extend the language by adding features from his favourite language, Simula 67. Simula 67 was one of the earliest object-oriented languages. Bjarne Stroustrup called it "C with classes" originally. The name C++ (Pronounced C plus plus) was coined by Rick Mascitti where "++" is the C increment operator. Ever since its birth, C++ evolved to cope with problems encountered by users, and through discussions at AT&T. However, the maturation of the C++ language was attested to by two events:
- The formation of an ANSI (American National Standard institute) C++ committee
 - The publication of the Annotated C++ Reference Manual by Ellis and Stroustrup.
 
The latest C++ standards document was issued by ANSI/ISO in year 2011 namely C++11 or formally C++0x .
The major reason behind the success and popularity of C++ is that it supports the object oriented technology, the latest in the software development and the most near to the real world.
Object oriented technology is regarded as the ultimate paradigm for the modelling of information, be that data or logic . The C++ has by now shown to fulfill the goal
1.2 C++ BASIC
1.2.1) C++ Character set
A character set is a set of valid characters that a language can recognise. A character represent any latter, digit, or any other sign. C++ has the following character set :
Letters A--Z, a--z
Digits 0--9
Special symbols Space + - * / ^ \ ( ) [ ] { } = < > . ' " $ , ; : % ! & ? _(underscore) # <= >= @
White Space 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.
1.2.2) Tokens
The smallest individual unit in a program is known as a token. C++ has the following tokens :
Keywords, Identifiers, Literals, Punctuators and operators.
(b) Identifiers-
An identifier is the name given by user for a unit of the program.
Even though original C++ considers all the characters in an identifier, significant yet it is implementation dependent. It varies from one version to another.
C++ is case sensitive as it treats upper-and lower-case characters differently.
My file DATE9_7_77 FILE13 Z2T0Z9
MY FILE _DS _CHK _HJI3_JK
DATA-REC contain special character
(Other than A-Z, a--z and 0-9)
29CLCT Starting with a digit
break reserved keyword
My.file contain special character.
(c) Literals-
Literals (often referred to as constants) are data items that never change their value during a program run.
C++ allows several kind of literals:
1. Integer-constant
2. Character-constant
3. Floating-constant
4. String-literal
- Integer Constants
 
Integer constant are whole numbers without any fractional part. The method of writing integer constants has been specified in the following note box.
C++ allows three types of integer constants:
Decimal (base 10)
Octal (base 8)
Hexadecimal (base 16)
>> Decimal integer constants
An integer constant consisting of a sequence of digits is taken to be decimal integer constant unless it begins with 0 (digit zero). For instance, 1234, 41, +97, -17 are decimal integer constants.
>> Octal integer constants:
A sequence of digits starting with 0 (digit zero) is taken to be an Octal integer. For instance, decimal integer 8 will be written as 010 as octal integer (.'.8¹⁰=10⁸) and decimal integer 12 will be written as 014 as octal integer (.'.12¹⁰=14⁸) when you start a number with 0 (zero), make sure that digit 8 or 9 is not included as octal numbers recognize digits 0-7 only. Therefore, numbers like digit 091, or 068 or 023 etc are illegal numbers and your program may behave erratically upon encountering such numbers.
>> Hexadecimal Integer Constants :
A sequence of digits preceded by 0x or 0X is taken to be an hexadecimal integer. For instance, decimal 12 will be written as OXC as hexadecimal integer.
Thus, number 12 can be written either as 12 (as decimal), 014 (as octal) and 0XC (as hexadecimal).
- Character constants
 
A character constant is a single character enclosed in single quotes, as in 'z' . The rule for writing character constant is given in adjacent note box.
Even non graphic characters can be represented by using escape sequence. An escape sequence is represented by a backslash ( \ ) followed by one or more characters.
- Floating constants
 
Floating constants are also called real constants.
Real constants are numbers having fractional parts. These may be written in one of the two forms called fractional form or the exponent form.
A real constant in fraction form consists of signed or unsigned digits including a decimal point between digits. The rule for writing a real constant in fraction form is given in note box.
- String Literals
 
Multiple Character constants can be dealt with in two ways in C++ . If enclosed in single quotes, these are treated as character constants and if enclosed in double quotes, these are treated as string - literals.
The rule for writing string-literal is given in adjacent note box.
Each string literal is automatically added with a terminating character ' \0 ' . Thus, the string "abc" will actually be represented as "abc\0" in the memory and its size is not 3 but 4 characters (inclusive of terminator character).
(d) Punctuators-
The following Characters ar used as Punctuators (also known as separator) in C++ :
[ ] ( ) { } , ; : * ... = #
That enhance a program's readability and give proper meaning to statement, expressions etc. as per syntax.
(e) Operators-
Operators ar tokens that trigger some computation or action when applied to variables and other objects in an expression.
The section 1.4 deals with operators in details. Different I/O operators (<< and >>), arithmetic operators (+, -, *, /, %), increment/decrement operators (+ +, - -), relational operators (==, <, >, <=, >=, ! =), logical operators (&&, ||, !) and conditional operator (?:) have been discussed here.
Comments
Post a Comment