Uploaded by hitmanpk.hf

C++ (Basic Short Notes)

advertisement
BASIC C++
SHORT NOTES
By intereducationonline
History Of C++
• In the early 1980s also in bell
laboratories another programming
language was created upon c language.
• This new Object Oriented language
called c++ was developed by Bjarne
Stroustrup.
Basic Structure of
C++ Program
Preprocessor Directive
Main function
C++ Statements
Header Files
Header files are the files that contain the definition
and declaration of many functions. These can be used
in the c++ program.
These files
iostream.h
conio.h
math.h
are stored with
“.h” extension.
string.h
iomanip.h
time.h
Comments in C++
The comment statements in c++ are non-executable
statements in c++. They are used to add comments or
remarks ina program.
Single
Multiple
// this is a signle line
comment
• /*this is a multiple line
comment*/
Escape Sequence
They are used to control the output on output device.
Escape
sequence
\a
Operation
Example
Produces alert(beep) sound
cout<<“Global\aVillage”;
The\bcomment
statements
in c++
non-executable
Moves
cursor backward
by oneare cout<<“Global\bVillage”;
position
statements in
c++. They are used to add comments or
\n
cursor to the beginning cout<<“\nGlobalVillage”;
remarks
inaMoves
program.
of next line
\r
Moves cursor to the beginning
of current line
cout<<“Global\rVillage”;
\t
Leaves 8 space from the left
blank.
cout<<“Global\tVillage”;
\\
Prints single backslash
cout<<“Global\\World”;
\’
Prints single quote
cout<<“\’Global\’ ”;
\”
Prints double quote
cout<<“\”Global\” ”;
Operators in C++
It is a special symbol used to perform specific operation on data.
Types of Operators
Symbols
Examples
Arithmetic operators
+, -, *, /, %
3+2
Assignment operators
=
a=2
Relational operators
< , >, <=, >=, ==, !=
a <= b
Logical operators
&&, ||, !
2 != 3
Increment / decrement
operators
k++, ++k
2++
Download