Plus One Computer Science Notes Chapter 5 Introduction to C++ Programming

Kerala Plus One Computer Science Notes Chapter 5 Introduction to C++ Programming

Summary
It is developed by Bjarne Stroustrup. It is an extension of C Language.

Character set:
To study a language first we have to familiarize the character set. For example to study English language first we have to study the alphabets. Similarly here the character set includes letters(A to Z & a to z), digits(0 to 9), special characters(+, -, ?, *, /, …..) white spaces(non printable) etc..

Token:
It is the smallest individual units similar to a word in English or Malayalam language. C++ has 5 tokens
1. Keywords:
These are reserved words for the compiler. We can’t use for any other purposes eg: float is used to declare variable to store numbers with decimal point. We can’t use this for any other purpose

2. Identifier:
These are user defined words. Eg: variable name, function name, class name, object name, etc…

3. Literals (Constants):
Its value does not change during execution
(a) Integer literals:
Whole numbers without fractional parts are known as integer literals, its value does not change during execution. There are 3 types decimal, octal and hexadecimal.
eg:

  • For decimal 100, 150, etc
  • For octal 0100, 0240, etc
  • For hexadecimal 0x100, 0x1A, etc

(b)Float literals:
A number with fractional parts and its value does not change during execution is called floating point literals. eg: 3.14157, 79.78, etc.

(c) Character literal-: A valid C++ character enclosed in single quotes, its value does not change during execution. eg: ‘m’, ‘f ’ etc

(d) String literal:
One or more characters enclosed in double quotes is called string constant. A string is automatically appended by a null character(‘\0’)
eg: “Mary’s”, ’’India”, etc.

4. Punctuators:
In English or Malayalam language punctuation mark are used to increase the readability but here it is used to separate the tokens. eg: {,}, (,).

5. Operators:
These are symbols used to perform an operation(Arithmetic, relational, logical, etc…)

Integrated Development Environment(IDE):
It is used for developing programs

  1. It helps to write as well as editing the program.
  2. It helps to compile the program and linking it to other (header files and other user) programs
  3. It helps to run the program

Turbo C++ IDE:
Following is an C++ IDE
Plus One Computer Science Notes Chapter 5 Introduction to C++ Programming 1
(a) Opening the edit window:
Method I: File → Click the menu item New
Method II: Press Alt and F simultaneously then press N

(b) Saving the program:
Click File → Save or Press Function key F2 or Alt + F and then press S. Then give a file name and press ok.

(c) Running/executing the program:
Press Alt + R then press R OR Click Run → press R, OR Press Ctrl + F9

(d) Viewing the output:
Press Alt + F5

(e) Closing Turbo C++ IDE:
Click File → then press Quit menu Or Press Alt + X

Geany IDE
Plus One Computer Science Notes Chapter 5 Introduction to C++ Programming 2
Step 1: Take Geany Editor and type the program (source code)
Step 2: Save the file with extension .cpp
Step 3: Compile the program by Click the Compile Option
Step 4: After successful compilation, Click Build option
Step 5: Then click on Execute option

Plus One Computer Science Notes