SlideShare a Scribd company logo
45 Days C++ Programming Language Training in Ambala
45 Days C++ Programming
Training In Ambala
www.batracomputercentre.com
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
Introduction To C++
• C++ is a middle-level programming language
developed by Bjarne Stroustrup starting in
1979 at Bell Labs. C++ runs on a variety of
platforms, such as Windows, Mac OS, and the
various versions of UNIX.
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com
History of C++
• C++ Development started in 1979.During the creation of Ph.D.
thesis, Bjarne Stroustrup worked with language called Simula.
• Bjarne Stroustrup identified that this OOP features can be
included in the software development
• C++ is also called as C with classes
• Stroustrup states that the purpose of C++ is to make writing good
programs easier and more pleasant for the individual
programmer.
• After that Bjarne Stroustrup started working on the C language
and added more extra OOP features to the classic C.He added
features in such a fashion that the basic flavor of C remains
unaffected.
• C++ programming language is extension to C Language. In C we
have already used increment operator (++). Therefore we called
C++ as “Incremented C” means Extension to C.
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com
Characteristics Of C++
• C++ Provides huge Function Library that’s why its
popularity is increasing day by day and more
programmers are inclining towards C++ due to its
multiple features –
• C++ is an Object Oriented Programming
Language (OOPL).
• C++ have huge Function Library
• C++ is highly Flexible language with Versatility.
• C++ can be used for developing System Software viz.,
operating systems, compilers, editors and data bases.
• C++ is suitable for Development of Reusable Software.
, thus reduces cost of software development.
• C++ is a Machine Independent Language.
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com
Features Of C++
1. Objects
2. Classes
3. Abstraction
4. Encapsulation
5. Inheritance
6. Overloading
7. Exception Handling
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com
Objects
• Objects are the basic unit of OOP. They are
instances of class, which have data members
and uses various member functions to
perform tasks.
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com
Classes
• Class can also be defined as user defined
data type but it also contains functions in it.
So, class is basically a blueprint for object. It
declare & defines what data variables the
object will have and what operations can be
performed on the class's object.
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com
Abstraction
• Abstraction refers to showing only the
essential features of the application and
hiding the details. In C++, classes provide
methods to the outside world to access & use
the data variables, but the variables are
hidden from direct access. This can be done
access specifiers.
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com
Encapsulation
• It can also be said data binding.
Encapsulation is all about binding the data
variables and functions together in class.
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com
Inheritance
• Inheritance is a way to reuse once written
code again and again. The class which is
inherited is called base calls & the class which
inherits is called derived class. So when, a
derived class inherits a base class, the
derived class can use all the functions which
are defined in base class, hence making code
reusable.
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com
Overloading
• It is a feature, which lets us create functions
with same name but different arguments,
which will perform differently. That is
function with same name, functioning in
different way. Or, it also allows us to redefine
a function to provide its new definition. You
will learn how to do this in details soon in
coming lessons.
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com
Variables In C++
• A variable provides us with named storage that our
programs can manipulate.
• Each variable in C++ has a specific type, which
determines the size and layout of the variable's
memory.
• the range of values that can be stored within that
memory;
• the set of operations that can be applied to the
variable.
• The name of a variable can be composed of letters,
digits, and the underscore character.
• It must begin with either a letter or an underscore.
• Upper and lowercase letters are distinct because C++
is case-sensitive.
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com
Constants In C++
• Constants refer to fixed values that the
program may not alter and they are
called literals.
• Constants can be of any of the basic data
types and can be divided into Integer
Numerals, Floating-Point Numerals,
Characters, Strings and Boolean Values.
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com
1) User Defined Data
Types
• These are the type, that user creates as a
class. In C++ these are classes where as in C it
was implemented by structures.
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com
a) Structures
• Structure is the collection of variables of different
types under a single name for better visualization of
problem and can hold data of one or more types.
• The struct keyword defines a structure type
followed by an identifier(name of the structure).
Then inside the curly braces, you can declare one or
more members (declare variables inside curly
braces) of that structure. For example:
struct person { char name[50]; int age; float salary;
};
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com
b) Unions
• Unions allow one portion of memory
to be accessed as different data
types. Its declaration and use is
similar to the one of structures, but
its functionality is totally different.
For Example:
union type_name { member_type1
member_name1; member_type2 member_name2;
member_type3 member_name3; . . }
object_names;
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com
c) Enumeration
Enumerated types are types that are defined
with a set of custom identifiers, known
as enumerators, as possible values. Objects
of these enumerated types can take any of
these enumerators as value.
Their syntax is:
This creates the type type_name, which can
take any of value1, value2, value3, ... as value.
Objects (variables) of this type can directly
be instantiated as object_names.
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com
d) Class
• C++ offers a new user-defined data type
known as class, which forms the basis of
object-oriented programming. A class acts as
a template which defines the data and
functions that are included in an object of a
class. Classes are declared using the keyword
class. Once a class has been declared, its
object can be easily created.
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com
2) Built In Data Type
• The basic (fundamental) data types provided by
C++ are integral, floating point and void data
type. Among these data types, the integral and
floating-point data types can be preceded by
several type modifiers.
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com
a) Int
• Numbers without the fractional part
represent integer data. In C++, the int data
type is used to store integers such as 4, 42,
5233, -32, -745. Thus, it cannot store
numbers such as 4.28, -62.533.
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com
b) Char
• Characters refer to the alphabet, numbers
and other characters (such as {, @, #, etc.)
defined in the ASCII character set. In C++, the
char data type is also treated as an integer
data type as the characters are internally
stored as integers that range in value from -
128 to 127
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com
c) Float
• A floating-point data type is used to store
real numbers such as 3 .28, 64. 755765, 8.01,
-24.53. This data type includes float and
double' data types.
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com
3) Derived Data Types
• Data types that are derived from the built-in
data types are known as derived data types.
The various derived data types provided by
C++ are arrays, functions, pointers and
references.
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com
a) Array
• An array is a set of elements of the same data
type that are referred to by the same name.
All the elements in an array are stored at
contiguous memory locations and each
element is accessed by a unique index or
subscript value. The subscript value indicates
the position of an element in an array.
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com
b) Functions
• A function is a self-contained program
segment that carries out a specific well-
defined task. In C++, every program contains
one or more functions which can be invoked
from other parts of a program, if required.
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com
c) Pointers
• A pointer is a variable that can store the
memory address of another variable.
Pointers allow to use the memory
dynamically. That is, with the help of
pointers, memory can be allocated or de-
allocated to the variables at run-time, thus,
making a program more efficient.
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com
d) References
• A reference is an alternative name for a
variable. That is, a reference is an alias for a
variable in a program. A variable and its
reference can be used interchangeably in a
program as both refer to the same memory
location
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com
Loops in C++
1. Loop control statements change execution
from its normal sequence. When execution
leaves a scope, all automatic objects that
were created in that scope are destroyed.
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com
Loop Type Description
For Loop
Execute a sequence of statements
multiple times and abbreviates the code
that manages the loop variable.
While Loop
Repeats a statement or group of
statements while a given condition is
true. It tests the condition before
executing the loop body.
Do while loop
Like a while statement, except that it
tests the condition at the end of the loop
body
Nested Loops
You can use one or more loop inside any
another while, for or do..while loop.
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com
Decision Making Statements
• Decision making structures require that the
programmer specify one or more conditions
to be evaluated or tested by the program,
along with a statement or statements to be
executed if the condition is determined to be
true, and optionally, other statements to be
executed if the condition is determined to be
false.
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com
Statements Description
If Statement
An if statement consists of a boolean
expression followed by one or more
statements.
If… Else Statement
An if statement can be followed by an
optional else statement, which
executes when the boolean expression
is false.
Switch Statements
A switch statement allows a variable to
be tested for equality against a list of
values.
Nested if statements
You can use one if or else if statement
inside another if or else if statement(s).
Nested Switch
Statements
You can use one switch statement
inside another switch statement(s).
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com
Basic Input/output
• The C++ standard libraries provide an extensive set of
input/output capabilities which we will see in
subsequent chapters. This chapter will discuss very
basic and most common I/O operations required for
C++ programming.
• C++ I/O occurs in streams, which are sequences of
bytes. If bytes flow from a device like a keyboard, a
disk drive, or a network connection etc. to main
memory, this is called input operation and if bytes
flow from main memory to a device like a display
screen, a printer, a disk drive, or a network
connection, etc, this is called output operation.
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com
Output Stream
The predefined object cout is an instance
of ostream class. The cout object is said to be
"connected to" the standard output device, which
usually is the display screen. The cout is used in
conjunction with the stream insertion operator,
which is written as << which are two less than
signs as shown in the following example.
cout << "Value of str is : " << str << endl;
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com
Input Stream
The predefined object cin is an instance
of istream class. The cin object is said to be
attached to the standard input device, which
usually is the keyboard. The cin is used in
conjunction with the stream extraction
operator, which is written as >> which are two
greater than signs as shown in the following
example.
cin >> name;
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com
C++ Programming
Language
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.comwww.batracomputercentre.com
C++ Programming Language
• Introduction
• Classes, Objects
• Inheritance
• Polymorphism
• Overloading
• Encapsulation
• Constructor &
Destructor
• Function
• Pointers Structure
• Arrays & Strings
• Structures, Union
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com
SCO-15 Dayal Bagh,
Near Panchmukhi Hanuman Mandir,
Ambala Cantt- 133001
Haryana
Ph. NO. : 4000670, 97296666770
www.batracomputercentre.com
info.jatinbatra@gmail.com
www.batracomputercentre.com
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
Email id: info.jatinbatra@gmail.com Ph. No.: 9729666670, 4000670
www.batracomputercentre.com

More Related Content

PPTX
Learn c++ Programming Language
PPTX
C++ Programming Language Training in Ambala ! Batra Computer Centre
PDF
PPTX
Cs1123 3 c++ overview
PPT
Basics of c++
ODP
(2) cpp imperative programming
PPTX
C++ AND CATEGORIES OF SOFTWARE
PPTX
C++ PROGRAMMING BASICS
Learn c++ Programming Language
C++ Programming Language Training in Ambala ! Batra Computer Centre
Cs1123 3 c++ overview
Basics of c++
(2) cpp imperative programming
C++ AND CATEGORIES OF SOFTWARE
C++ PROGRAMMING BASICS

What's hot (20)

PPT
Basics of c++ Programming Language
PPTX
Tokens expressionsin C++
PDF
C++ Tokens
PPTX
Presentation on C++ Programming Language
PPTX
Learning C++ - Introduction to c++ programming 1
PPS
C++ Language
PDF
Introduction to cpp
PDF
Intro to C++ - language
PPT
C++ programming program design including data structures
PPT
C++ Language
PPTX
C++ theory
PPTX
basics of c++
PDF
C++ book
PPT
Basic concept of c++
PPTX
Object Oriented Programming with C++
PDF
Managing I/O in c++
PPTX
C introduction by thooyavan
DOCX
C cheat sheet for varsity (extreme edition)
PPTX
Introduction to C++
PPTX
C++ Overview PPT
Basics of c++ Programming Language
Tokens expressionsin C++
C++ Tokens
Presentation on C++ Programming Language
Learning C++ - Introduction to c++ programming 1
C++ Language
Introduction to cpp
Intro to C++ - language
C++ programming program design including data structures
C++ Language
C++ theory
basics of c++
C++ book
Basic concept of c++
Object Oriented Programming with C++
Managing I/O in c++
C introduction by thooyavan
C cheat sheet for varsity (extreme edition)
Introduction to C++
C++ Overview PPT
Ad

Viewers also liked (20)

PPT
01 c++ Intro.ppt
PDF
20130110 prs presentation ncim c++ 11
PPTX
6 Week Basic Computer Trainning In Ambala! BATRA COMPUTER CENTRE
PPT
Microsoft excel
PPT
Looping in c++
PDF
Cpp loop types
PPT
Looping in c++
PPTX
Exel avanzado
PPT
Chapter 7 - The Repetition Structure
PPT
C++loop statements
PPT
While loop
PDF
[C++]3 loop statement
PPTX
Loop c++
DOCX
12th CBSE Practical File
PPTX
C++ loop
PPTX
Loops c++
PPTX
Tutorial 7: Advanced Functions and Conitional Formating
PPT
lecture1 introduction to computer graphics(Computer graphics tutorials)
DOCX
Computer science project work
PPTX
Introduction to Computer graphics
01 c++ Intro.ppt
20130110 prs presentation ncim c++ 11
6 Week Basic Computer Trainning In Ambala! BATRA COMPUTER CENTRE
Microsoft excel
Looping in c++
Cpp loop types
Looping in c++
Exel avanzado
Chapter 7 - The Repetition Structure
C++loop statements
While loop
[C++]3 loop statement
Loop c++
12th CBSE Practical File
C++ loop
Loops c++
Tutorial 7: Advanced Functions and Conitional Formating
lecture1 introduction to computer graphics(Computer graphics tutorials)
Computer science project work
Introduction to Computer graphics
Ad

Similar to 45 Days C++ Programming Language Training in Ambala (20)

PPTX
45 Days C Language Training In Ambala! Batra Computer Centre
PPTX
C Language Training in Ambala ! Batra Computer Centre
PPT
cs8251 unit 1 ppt
PPTX
Data Types & Input/Output Streams.pptx — Description
PPT
Objective-C for iOS Application Development
PPTX
Object Oriented Programming Using C++.pptx
PDF
01 objective-c session 1
PPTX
Programming in C
PPTX
Object oriented programming. (1).pptx
PPTX
Data Structures and Algorithms_Updated.pptx
PPT
C++ - A powerful and system level language
PPTX
Cs1123 11 pointers
PPTX
lecture NOTES ON OOPS C++ ON CLASS AND OBJECTS
PDF
slideset 7 structure and union (1).pdf
PPT
lecture02-cpp.ppt
PPT
lecture02-cpp.ppt
PPT
lecture02-cpp.ppt
PPT
lecture02-cpp.ppt
PPTX
C Language Training in Ambala ! Batra Computer Centre
PPT
Learn c sharp at amc square learning
45 Days C Language Training In Ambala! Batra Computer Centre
C Language Training in Ambala ! Batra Computer Centre
cs8251 unit 1 ppt
Data Types & Input/Output Streams.pptx — Description
Objective-C for iOS Application Development
Object Oriented Programming Using C++.pptx
01 objective-c session 1
Programming in C
Object oriented programming. (1).pptx
Data Structures and Algorithms_Updated.pptx
C++ - A powerful and system level language
Cs1123 11 pointers
lecture NOTES ON OOPS C++ ON CLASS AND OBJECTS
slideset 7 structure and union (1).pdf
lecture02-cpp.ppt
lecture02-cpp.ppt
lecture02-cpp.ppt
lecture02-cpp.ppt
C Language Training in Ambala ! Batra Computer Centre
Learn c sharp at amc square learning

More from jatin batra (20)

PDF
Best SMO Training &Coaching in Ambala
PDF
Best HTML Training &Coaching in Ambala
PDF
Best SEO Training & Coaching in Ambala
PDF
Best Photoshop Training in Ambala
PDF
Best C Programming Training & Coaching in Ambala
PDF
BASIC COMPUTER TRAINING & COACHING CENTRE IN AMBALA CANTT
PPTX
Web Browser ! Batra Computer Centre
PPTX
Search Engine Training in Ambala ! Batra Computer Centre
PPTX
Networking Training in Ambala ! Batra Computer Centre
PPTX
SQL Training in Ambala ! BATRA COMPUTER CENTRE
PPTX
Networking ! BATRA COMPUTER CENTRE
PPTX
Ms Office 2010 Training in Ambala ! BATRA COMPUTER CENTRE
PPTX
Basic Computer Training Centre in Ambala ! BATRA COMPUTER CENTRE
PPTX
Corel Draw Training Institute in Ambala ! BATRA COMPUTER CENTRE
PPTX
Basic Computer Training Institute ! BATRA COMPUTER CENTRE
PPTX
HTML Training Institute in Ambala ! Batra Computer Centre
PPTX
Benefits of Web Browser ! Batra Computer Centre
PPTX
SEO Training in Ambala ! Batra Computer Centre
PPTX
Internet Training Centre in Ambala ! Batra Computer Centre
PPTX
Basic Computer Training Centre in Ambala ! Batra Computer Centre
Best SMO Training &Coaching in Ambala
Best HTML Training &Coaching in Ambala
Best SEO Training & Coaching in Ambala
Best Photoshop Training in Ambala
Best C Programming Training & Coaching in Ambala
BASIC COMPUTER TRAINING & COACHING CENTRE IN AMBALA CANTT
Web Browser ! Batra Computer Centre
Search Engine Training in Ambala ! Batra Computer Centre
Networking Training in Ambala ! Batra Computer Centre
SQL Training in Ambala ! BATRA COMPUTER CENTRE
Networking ! BATRA COMPUTER CENTRE
Ms Office 2010 Training in Ambala ! BATRA COMPUTER CENTRE
Basic Computer Training Centre in Ambala ! BATRA COMPUTER CENTRE
Corel Draw Training Institute in Ambala ! BATRA COMPUTER CENTRE
Basic Computer Training Institute ! BATRA COMPUTER CENTRE
HTML Training Institute in Ambala ! Batra Computer Centre
Benefits of Web Browser ! Batra Computer Centre
SEO Training in Ambala ! Batra Computer Centre
Internet Training Centre in Ambala ! Batra Computer Centre
Basic Computer Training Centre in Ambala ! Batra Computer Centre

Recently uploaded (20)

PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
Electrolyte Disturbances and Fluid Management A clinical and physiological ap...
PDF
Sunset Boulevard Student Revision Booklet
PPTX
Nursing Management of Patients with Disorders of Ear, Nose, and Throat (ENT) ...
PPTX
Presentation on Janskhiya sthirata kosh.
PDF
2.Reshaping-Indias-Political-Map.ppt/pdf/8th class social science Exploring S...
PDF
Mga Unang Hakbang Tungo Sa Tao by Joe Vibar Nero.pdf
PDF
Cell Biology Basics: Cell Theory, Structure, Types, and Organelles | BS Level...
PPTX
Open Quiz Monsoon Mind Game Prelims.pptx
PPTX
Skill Development Program For Physiotherapy Students by SRY.pptx
PDF
Module 3: Health Systems Tutorial Slides S2 2025
PDF
The Final Stretch: How to Release a Game and Not Die in the Process.
PPTX
NOI Hackathon - Summer Edition - GreenThumber.pptx
PPTX
Software Engineering BSC DS UNIT 1 .pptx
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
DOCX
UPPER GASTRO INTESTINAL DISORDER.docx
PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
PDF
Types of Literary Text: Poetry and Prose
PDF
Landforms and landscapes data surprise preview
PDF
3.The-Rise-of-the-Marathas.pdfppt/pdf/8th class social science Exploring Soci...
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Electrolyte Disturbances and Fluid Management A clinical and physiological ap...
Sunset Boulevard Student Revision Booklet
Nursing Management of Patients with Disorders of Ear, Nose, and Throat (ENT) ...
Presentation on Janskhiya sthirata kosh.
2.Reshaping-Indias-Political-Map.ppt/pdf/8th class social science Exploring S...
Mga Unang Hakbang Tungo Sa Tao by Joe Vibar Nero.pdf
Cell Biology Basics: Cell Theory, Structure, Types, and Organelles | BS Level...
Open Quiz Monsoon Mind Game Prelims.pptx
Skill Development Program For Physiotherapy Students by SRY.pptx
Module 3: Health Systems Tutorial Slides S2 2025
The Final Stretch: How to Release a Game and Not Die in the Process.
NOI Hackathon - Summer Edition - GreenThumber.pptx
Software Engineering BSC DS UNIT 1 .pptx
102 student loan defaulters named and shamed – Is someone you know on the list?
UPPER GASTRO INTESTINAL DISORDER.docx
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
Types of Literary Text: Poetry and Prose
Landforms and landscapes data surprise preview
3.The-Rise-of-the-Marathas.pdfppt/pdf/8th class social science Exploring Soci...

45 Days C++ Programming Language Training in Ambala

  • 2. 45 Days C++ Programming Training In Ambala www.batracomputercentre.com Email id: [email protected] Ph. No.: 9729666670, 4000670
  • 3. Introduction To C++ • C++ is a middle-level programming language developed by Bjarne Stroustrup starting in 1979 at Bell Labs. C++ runs on a variety of platforms, such as Windows, Mac OS, and the various versions of UNIX. Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com
  • 4. History of C++ • C++ Development started in 1979.During the creation of Ph.D. thesis, Bjarne Stroustrup worked with language called Simula. • Bjarne Stroustrup identified that this OOP features can be included in the software development • C++ is also called as C with classes • Stroustrup states that the purpose of C++ is to make writing good programs easier and more pleasant for the individual programmer. • After that Bjarne Stroustrup started working on the C language and added more extra OOP features to the classic C.He added features in such a fashion that the basic flavor of C remains unaffected. • C++ programming language is extension to C Language. In C we have already used increment operator (++). Therefore we called C++ as “Incremented C” means Extension to C. Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com
  • 5. Characteristics Of C++ • C++ Provides huge Function Library that’s why its popularity is increasing day by day and more programmers are inclining towards C++ due to its multiple features – • C++ is an Object Oriented Programming Language (OOPL). • C++ have huge Function Library • C++ is highly Flexible language with Versatility. • C++ can be used for developing System Software viz., operating systems, compilers, editors and data bases. • C++ is suitable for Development of Reusable Software. , thus reduces cost of software development. • C++ is a Machine Independent Language. Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com
  • 6. Features Of C++ 1. Objects 2. Classes 3. Abstraction 4. Encapsulation 5. Inheritance 6. Overloading 7. Exception Handling Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com
  • 7. Objects • Objects are the basic unit of OOP. They are instances of class, which have data members and uses various member functions to perform tasks. Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com
  • 8. Classes • Class can also be defined as user defined data type but it also contains functions in it. So, class is basically a blueprint for object. It declare & defines what data variables the object will have and what operations can be performed on the class's object. Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com
  • 9. Abstraction • Abstraction refers to showing only the essential features of the application and hiding the details. In C++, classes provide methods to the outside world to access & use the data variables, but the variables are hidden from direct access. This can be done access specifiers. Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com
  • 10. Encapsulation • It can also be said data binding. Encapsulation is all about binding the data variables and functions together in class. Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com
  • 11. Inheritance • Inheritance is a way to reuse once written code again and again. The class which is inherited is called base calls & the class which inherits is called derived class. So when, a derived class inherits a base class, the derived class can use all the functions which are defined in base class, hence making code reusable. Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com
  • 12. Overloading • It is a feature, which lets us create functions with same name but different arguments, which will perform differently. That is function with same name, functioning in different way. Or, it also allows us to redefine a function to provide its new definition. You will learn how to do this in details soon in coming lessons. Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com
  • 13. Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com
  • 14. Variables In C++ • A variable provides us with named storage that our programs can manipulate. • Each variable in C++ has a specific type, which determines the size and layout of the variable's memory. • the range of values that can be stored within that memory; • the set of operations that can be applied to the variable. • The name of a variable can be composed of letters, digits, and the underscore character. • It must begin with either a letter or an underscore. • Upper and lowercase letters are distinct because C++ is case-sensitive. Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com
  • 15. Constants In C++ • Constants refer to fixed values that the program may not alter and they are called literals. • Constants can be of any of the basic data types and can be divided into Integer Numerals, Floating-Point Numerals, Characters, Strings and Boolean Values. Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com
  • 16. Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com
  • 17. 1) User Defined Data Types • These are the type, that user creates as a class. In C++ these are classes where as in C it was implemented by structures. Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com
  • 18. a) Structures • Structure is the collection of variables of different types under a single name for better visualization of problem and can hold data of one or more types. • The struct keyword defines a structure type followed by an identifier(name of the structure). Then inside the curly braces, you can declare one or more members (declare variables inside curly braces) of that structure. For example: struct person { char name[50]; int age; float salary; }; Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com
  • 19. b) Unions • Unions allow one portion of memory to be accessed as different data types. Its declaration and use is similar to the one of structures, but its functionality is totally different. For Example: union type_name { member_type1 member_name1; member_type2 member_name2; member_type3 member_name3; . . } object_names; Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com
  • 20. c) Enumeration Enumerated types are types that are defined with a set of custom identifiers, known as enumerators, as possible values. Objects of these enumerated types can take any of these enumerators as value. Their syntax is: This creates the type type_name, which can take any of value1, value2, value3, ... as value. Objects (variables) of this type can directly be instantiated as object_names. Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com
  • 21. d) Class • C++ offers a new user-defined data type known as class, which forms the basis of object-oriented programming. A class acts as a template which defines the data and functions that are included in an object of a class. Classes are declared using the keyword class. Once a class has been declared, its object can be easily created. Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com
  • 22. 2) Built In Data Type • The basic (fundamental) data types provided by C++ are integral, floating point and void data type. Among these data types, the integral and floating-point data types can be preceded by several type modifiers. Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com
  • 23. a) Int • Numbers without the fractional part represent integer data. In C++, the int data type is used to store integers such as 4, 42, 5233, -32, -745. Thus, it cannot store numbers such as 4.28, -62.533. Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com
  • 24. b) Char • Characters refer to the alphabet, numbers and other characters (such as {, @, #, etc.) defined in the ASCII character set. In C++, the char data type is also treated as an integer data type as the characters are internally stored as integers that range in value from - 128 to 127 Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com
  • 25. c) Float • A floating-point data type is used to store real numbers such as 3 .28, 64. 755765, 8.01, -24.53. This data type includes float and double' data types. Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com
  • 26. 3) Derived Data Types • Data types that are derived from the built-in data types are known as derived data types. The various derived data types provided by C++ are arrays, functions, pointers and references. Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com
  • 27. a) Array • An array is a set of elements of the same data type that are referred to by the same name. All the elements in an array are stored at contiguous memory locations and each element is accessed by a unique index or subscript value. The subscript value indicates the position of an element in an array. Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com
  • 28. b) Functions • A function is a self-contained program segment that carries out a specific well- defined task. In C++, every program contains one or more functions which can be invoked from other parts of a program, if required. Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com
  • 29. c) Pointers • A pointer is a variable that can store the memory address of another variable. Pointers allow to use the memory dynamically. That is, with the help of pointers, memory can be allocated or de- allocated to the variables at run-time, thus, making a program more efficient. Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com
  • 30. d) References • A reference is an alternative name for a variable. That is, a reference is an alias for a variable in a program. A variable and its reference can be used interchangeably in a program as both refer to the same memory location Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com
  • 31. Loops in C++ 1. Loop control statements change execution from its normal sequence. When execution leaves a scope, all automatic objects that were created in that scope are destroyed. Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com
  • 32. Loop Type Description For Loop Execute a sequence of statements multiple times and abbreviates the code that manages the loop variable. While Loop Repeats a statement or group of statements while a given condition is true. It tests the condition before executing the loop body. Do while loop Like a while statement, except that it tests the condition at the end of the loop body Nested Loops You can use one or more loop inside any another while, for or do..while loop. Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com
  • 33. Decision Making Statements • Decision making structures require that the programmer specify one or more conditions to be evaluated or tested by the program, along with a statement or statements to be executed if the condition is determined to be true, and optionally, other statements to be executed if the condition is determined to be false. Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com
  • 34. Statements Description If Statement An if statement consists of a boolean expression followed by one or more statements. If… Else Statement An if statement can be followed by an optional else statement, which executes when the boolean expression is false. Switch Statements A switch statement allows a variable to be tested for equality against a list of values. Nested if statements You can use one if or else if statement inside another if or else if statement(s). Nested Switch Statements You can use one switch statement inside another switch statement(s). Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com
  • 35. Basic Input/output • The C++ standard libraries provide an extensive set of input/output capabilities which we will see in subsequent chapters. This chapter will discuss very basic and most common I/O operations required for C++ programming. • C++ I/O occurs in streams, which are sequences of bytes. If bytes flow from a device like a keyboard, a disk drive, or a network connection etc. to main memory, this is called input operation and if bytes flow from main memory to a device like a display screen, a printer, a disk drive, or a network connection, etc, this is called output operation. Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com
  • 36. Output Stream The predefined object cout is an instance of ostream class. The cout object is said to be "connected to" the standard output device, which usually is the display screen. The cout is used in conjunction with the stream insertion operator, which is written as << which are two less than signs as shown in the following example. cout << "Value of str is : " << str << endl; Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com
  • 37. Input Stream The predefined object cin is an instance of istream class. The cin object is said to be attached to the standard input device, which usually is the keyboard. The cin is used in conjunction with the stream extraction operator, which is written as >> which are two greater than signs as shown in the following example. cin >> name; Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com
  • 38. Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com
  • 39. C++ Programming Language Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.comwww.batracomputercentre.com
  • 40. C++ Programming Language • Introduction • Classes, Objects • Inheritance • Polymorphism • Overloading • Encapsulation • Constructor & Destructor • Function • Pointers Structure • Arrays & Strings • Structures, Union Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com
  • 41. Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com SCO-15 Dayal Bagh, Near Panchmukhi Hanuman Mandir, Ambala Cantt- 133001 Haryana Ph. NO. : 4000670, 97296666770 www.batracomputercentre.com [email protected]
  • 43. Email id: [email protected] Ph. No.: 9729666670, 4000670 www.batracomputercentre.com