Programming with C++ note compatibility mode
Overview of C++
C++ is a computer programming language
developed in 1980 by Bjarne Stroustrup at the Bell Telephone
Laboratories. C++ is an Object Oriented Programming Language, which follow
oops concept like, inheritance, encapsulation, abstraction and polymorphism.
Where we use C++ Language
C++ Language is mainly used for;
·
Design
Operating system
·
Design Language
Compiler
·
Design
Database
·
Utilities
·
Application
Software
Features of C++
C++ is object oriented programming language and
it is a very simple and easy language, this language have following features.
·
Simple
·
Portability
·
Powerful
·
Platform dependent
·
Object
oriented oriented
·
Case
sensitive
·
Compiler
based
·
Syntax
based language
·
Use of
Pointers
Simple
Every C++ program can be written in simple
English language so that it is very easy to understand and developed by
programmer.
Platform dependent
A language is said to be platform dependent
whenever the program is execute in the same operating system where that was
developed and compiled but not run and execute on other operating system. C++
is platform dependent language.
Note: .obj
file of C++ program is platform dependent.
Portability
It is the concept of carrying the instruction
from one system to another system. In C++ Language.cpp file contain source
code, we can edit also this code. .exe file contain application, only
we can execute this file. When we write and compile any C++ program on window
operating system that program easily run on other window based system.
When we can copy .exe file to any other computer
which contain window operating system then it works properly, because the native
code of application an operating system is same.
Powerful
C++ is a very powerful programming language, it
have a wide verity of data types, functions, control statements, decision
making statements, etc.
Object oriented Programming language
This main advantage of C++ is, it is object
oriented programming language. It follow concept of oops like polymorphism,
inheritance, encapsulation, abstraction.
Case sensitive
C+ is a case sensitive programming language. In
C++ programming 'break and BREAK' both are different.
If any language treats lower case latter
separately and upper case latter separately than they can be called as case
sensitive programming language [Example c, c++, java, .net are sensitive
programming languages.] other wise it is called as case
insensitive programming language [Example HTML, SQL is case insensitive
programming languages].
Compiler based
C++ is a compiler based programming language
that means without compilation no C++ program can be executed. First we need
compiler to compile our program and then execute.
Syntax based language
C++ is a strongly tight syntax based programming
language. If any language follow rules and regulation very strictly known as
strongly tight syntax based language. Example C, C++, Java, .net etc. If any
language not follow rules and regulation very strictly known as loosely tight
syntax based language.
Example HTML.
Example HTML.
Efficient use of pointers
Pointers is a variable which hold the address of
another variable, pointer directly direct access to memory address of any
variable due to this performance of application is improve. In C++ language
also concept of pointer are available.
Applications of C++
Mainly C++ Language is used for Develop Desktop
application and system software. Some application of C++ language are given
below.
·
For Develop Graphical related application like
computer and mobile games.
·
To evaluate any kind of mathematical equation
use C++ language.
·
C++ Language are also used for design OS. Like
window xp.
·
Few parts of apple OS X are written in C++ programming
language.
·
Internet browser Firefox are written in C++
programming language
·
All major applications of adobe systems are
developed in C++ programming language. Like Photoshop, ImageReady, Illustrator
and Adobe Premier.
·
Some of the Google applications are also written
in C++, including Google file system and Google Chromium.
·
C++ are
used for design database like MySQL.
Compiler
A
compiler is system software which converts programming language code into
binary format in single steps. In other words Compiler is a system software
which can take input from other any programming language and convert it into
lower level machine dependent language.
Interpreter
It
is system software which is used to convert programming language code into binary
format in step by step process.
Assembler
·
An assembler is system software which is used to
convert the assembly language instructioninto binary format in step by step
process. An assembler is system software which is used to convert the assembly language
instruction into binary format.
Compiler Vs Interpreter
No
|
Compiler
|
Interpreter
|
1
|
Compiler takes Entire program as input at a time.
|
Interpreter takes Single instruction as input at a time.
|
2
|
Intermediate Object code is generated
|
No Intermediate Object code is generated
|
3
|
It execute conditional control statements fastly.
|
It execute conditional control statements slower than Compiler
|
4
|
More memory is required.
|
Less memory is required.
|
5
|
Program need not to be compiled every time
|
Every time higher level program is converted into lower level
program
|
6
|
It display error after entire program is checked
|
It display error after each instruction interpreted (if any)
|
7
|
Example: C, C++
|
Example: BASIC
|
Comments in C++
Generally Comments are used to provide the description about the Logic
written in program. Comments are not display on output screen.
When we are used the comments, then that
specific part will be ignored by compiler.
In 'C++' language two types of comments are
possible
·
Single
line comments
·
Multiple
line comments
Single line comments
Single line comments can be provided by using /
/....................
Multiple line comments
Multiple line comments can be provided by using
/*......................*/
Note: When we are working with the multiple line
comments then nested comments are not possible.
Rules for Writing Comments
1. Program contains any
number of comments at any place.
Example
//
header files
#include<iostream.h>
#include<conio.h>
void
main()
{
//
variable declaration
int
a,b,c;
a=10;
b=20;
c=a+b;
cout<<"Sum:
"<<c;
getch();
}
2. Nested Comments are not
possible, that means comments within comments.
Example
void
main()
{
/*
/* comments
*/
*/
}
3. Comments can be splits
over more than one line.
Example
void
main()
{
/*
main
Function
Body part
*/
}
4. Comments are not case
sensitive.
Example
void
main()
{
/*
MAIN Function BODY */
}
5. Single line comments
start with "//"
Programming with C++ note compatibility mode
Reviewed by Pezziny Jossboss
on
July 01, 2018
Rating:
No comments:
Show your Contribution