1. Introduction to C++
Developer
-
C++ was developed by Bjarne Stroustrup.
Company
-
Developed at AT&T Bell Laboratories.
Launching Year
-
Development started in 1979.
-
First released in 1983.
C++ was developed by Bjarne Stroustrup.
Developed at AT&T Bell Laboratories.
Development started in 1979.
First released in 1983.
The original name of C++ was C with Classes.
Later the name was changed to C++.
In C language, ++ is an increment operator which means adding one.
Therefore C++ means an improved or extended version of C language.
C++ supports all the basic features of C language and also provides additional features.
C++ supports all primary concepts of C such as:
Data Types
Operators
Control Statements
Functions
C++ also supports Object Oriented Programming (OOP) concepts, such as:
Class
Object
Encapsulation
Inheritance
Polymorphism
Abstraction
Because of these features, C++ is called an Object Oriented Programming Language.
| C Language | C++ Language |
|---|---|
| Most common header file is stdio.h | Most common header file is iostream |
| Provides functions printf() and scanf() | Provides objects cout, cin, cerr, clog |
| printf() is used for console output | cout is used for console output |
| scanf() is used for console input | cin is used for console input |
C++ is a high level, object oriented programming language.
It is a case sensitive language.
Example: A and a are different.
A program is a set of instructions given to a computer to perform a specific task.
A character is the smallest unit of a program used to form tokens.
Examples:
Letters (A–Z), Numbers (0–9), Symbols (+ - * / #)
## is a preprocessor directive.
#includeUsed to include header files in a program.
Example:
< >Called angular brackets.
A file that contains functions and libraries used in programs.
Example:
<iostream> → Input/Output
<conio.h> → Console input/output
.h = Header file extension
Stream means flow of data (bytes).
main() FunctionThe starting point of program execution.
Example:
{ }Curly braces
{ → Start of block
} → End of block
;Semicolon → End of statement
coutUsed to display output on the screen.
Example:
cinUsed to take input from keyboard.
Example:
<<Left shift operator
Used with cout for output.
>>Right shift operator
Used with cin for input.
" "Double quotes used for string/message.
Example:
getch()Used to hold the screen.
clrscr()Used to clear the screen.