Kerala Plus One Computer Application Notes Chapter 4 Getting Started with C++
It is developed by Bjarne Stroustrup. It is an extension of the C Language.
Character set: To study a language first we have to familiarize the character set. For example, to study the English language first we have to study the alphabet. 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 unit 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 it for any other purposes
Eg: float is used to declare variables to store numbers with a 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
i) Integer literals: Whole numbers without fractional parts are known as integer literals, its value does not change during execution. There are 3 types of decimal, octal, and hexadecimal.
Eg. Fordecimal 100, 150, etc..
For octal 0100, 0240, etc..
For hexadecimal 0 × 100, 0 × 1A, etc
ii) 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…
iii) Character literal: A valid C++ character enclosed in single quotes, its value does not change during execution.
Eg. ‘m’, ‘f ’ etc
iv) 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 marks 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
- It helps to write as well as editing the program.
- It helps to compile the program and linking it to other (header files and other users) programs
- It helps to run the program
Turbo C++ IDE
Following is a C++ IDE
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
- 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 the Build option
- Step 5: Then click on the Execute option