Tuesday, 8 January 2013



C++ (read as c plus plus) is one of the oldest programming languages. It was developed by Bjarne Stroustrup in the 1980s, in the AT&T Bell Labs. He found C lacking for simluations and decided to extend the language by adding features from his favourite languages simula 67.


Letters:     A-Z, a-z
Digits:       0-9
Symbols:  !, @, #, $, _, -, =, (), [], {}, ^, &, etc
Spaces:    blank space, vertical space, horizontal space

Important terms that you must know:-
  The smallest individual units of a C++ program are called tokens
   e.g. main, void, {} .etc
    C++ has the following tokens:
    (i) Keywords:
        Keywords are those reserved words which convey a special meaning to the compiler. These cannot be
        used by a programmer for other purposes than for the one it is already reserved.
        e.g. void, main, int, float, if, else, include, getch, cout, cin,.etc

    (ii) Identifiers: 
        An arbitrarily long sequence of letters and digits,  which are used for general terminology for given
        names to different parts of program like variables, objects, classes,.etc are called identifiers.

    (iii) Literals: 
         Literals are those data items that never change there value under any circumstances(or during the
         program run).
         Types Of Literals:
          1. Integer-Constants:
              Whole numbers (without fractional parts) are integer constants.
               e.g. 12, 30098, -96, -147
          2. Floating-Constants:
              Numbers having fractional parts are called floating point constants. They are also called real
              e.g. 12.03, -99.99, 125.0
          3. Character-Constants:
              One character enclosed in single quotes ( ' ' ) is called a character constant.
              e.g. 'a', 'Q', 'Z'
              ESCAPE SEQUENCE:
              A backslash followed by one or more character contstants are called escape sequences.
              e.g. '\n' (used for new line), '\t' (used for horizontal tab), etc.
              These are non-graphic characters.
          4. String-literals:
              Multiple character constants enclosed within double quotes are called string-literals.
              e.g. "QWERTY", "Hello World"
     (iv) Punctuators:
           Characters used as separators are called punctuators.
           e.g.     (  )  {  }   ,    ;    :     etc
     (v) Operators: 
          Tokens that trigger some computation when used are called operators.
           e.g.  the + operator triggers addition, the * triggers division

          Types of operators: 
          1. Binary Operators:
              These operators are used with two operands.
               e.g.  + (addition), -(subtraction), *(multiplication), / (division)
          2. Unary operators:
              These operators are used with two operands.
               e.g. ++ (increment operator), -- (decrement operator), & (address operator) etc
          3. Ternary Operators:
              These are used with three operands.
              There is only one ternary operator-the conditional operator.
                     (condition1)?(condition if true):(condition if false)

So, thats all the basic stuff anyone has to know before taking a first look at a C++ program. (•‿•)

No comments:

Post a Comment