SlideShare ist ein Scribd-Unternehmen logo
1 von 12
-A.Sujatha M.Sc.,M.Phil.,PGDCA.,
-M.Mohana Malar M.Sc., M.Phil.,
 The major motivating factor in the invention of object-
oriented approach is to remove some of the flaws
encountered in the procedural approach. OOP treats
data as a critical element in the program development
and does not allow it to flow freely around the system.
It ties data more closely to the function that operate on
it, and protects it from accidental modification from
outside function. OOP allows decomposition of a
problem into a number of entities called objects and
then builds data and function around these objects.
The data of an object can be accessed only by the
function associated with that object. However, function
of one object can access the function of other objects.
It is necessary to understand some of the
concepts used extensively in object-oriented
programming. These include:
 Objects
 Classes
 Data abstraction and encapsulation
 Inheritance
 Polymorphism
 Dynamic binding
 Message passing
OOP offers several benefits to both the program designer and the user. Object-
Orientation contributes to the solution of many problems associated with the development and
quality of software products. The new technology promises greater programmer productivity,
better quality of software and lesser maintenance cost. The principal advantages are:
 Through inheritance, we can eliminate redundant code extend the use of existing Classes.
 We can build programs from the standard working modules that communicate with one
another, rather than having to start writing the code from scratch. This leads to saving of
development time and higher productivity.
 The principle of data hiding helps the programmer to build secure program that can not be
invaded by code in other parts of a programs.
 It is possible to have multiple instances of an object to co-exist without any interference.
 It is possible to map object in the problem domain to those in the program.
 It is easy to partition the work in a project based on objects.
 The data-centered design approach enables us to capture more detail of a model can
implemental form.
 Object-oriented system can be easily upgraded from small to large system.
 Message passing techniques for communication between objects makes to interface
descriptions with external systems much simpler.
 Software complexity can be easily managed.
OOP has become one of the programming buzzwords today. There appears to
be a great deal of excitement and interest among software engineers in using OOP.
Applications of OOP are beginning to gain importance in many areas. The most
popular application of object-oriented programming, up to now, has been in the
area of user interface design such as window. Hundreds of windowing systems
have been developed, using the OOP techniques.
Real-business system are often much more complex and contain many more
objects with complicated attributes and method. OOP is useful in these types of
application because it can simplify a complex problem. The promising areas of
application of OOP include:
 Real-time system
 Simulation and modeling
 Object-oriented data bases
 Hypertext, Hypermedia, and expertext
 AI and expert systems
 Neural networks and parallel programming
 Decision support and office automation systems
 CIM/CAM/CAD systems
We have used the following #include
directive in the program:
#include <iostream>
 The #include directive instructs the compiler
to include the contents of the file enclosed
within angular brackets into the source file.
The header file iostream.h should be included
at the beginning of all programs that use
input/output statements.
Namespace is a new concept introduced by
the ANSI C++ standards committee. This defines
a scope for the identifiers that are used in a
program. For using the identifier defined in the
namespace scope we must include the using
directive, like
Using namespace std;
Here, std is the namespace where ANSI C++
standard class libraries are defined. All ANSI C++
programs must include this directive. This will
bring all the identifiers defined in std to the
current global scope. Using and namespace are
the new keyword of C++.
 In C++, main () returns an integer value to
the operating system. Therefore, every main
() in C++ should end with a return (0)
statement; otherwise a warning an error
might occur. Since main () returns an integer
type for main () is explicitly specified as int.
Note that the default return type for all
function in C++ is int.
AVERAGE OF TWO NUMBERS
#include<iostream.h> // include header file
Using namespace std;
int main()
{
float number1, number2,sum, average;
cin >> number1; // Read Numbers
cin >> number2; // from keyboard
sum = number1 + number2;
average = sum/2;
cout << ”Sum = “ << sum << “n”;
cout << “Average = “ << average << “n”;
return 0;
} //end of example
The output would be:
Enter two numbers: 6.5 7.5
Sum = 14
Average = 7
 One of the major features of C++ is classes.
They provide a method of binding together
data and functions which operate on them.
Like structures in C, classes are user-defined
data types.
USE OF CLASS
#include<iostream.h> // include header file
using namespace std;
class person
{
char name[30];
Int age;
public:
void getdata(void);
void display(void);
};
void person :: getdata(void)
{
cout << “Enter name: “;
cin >> name;
cout << “Enter age: “;
cin >> age;
}
Void person : : display(void)
{
cout << “nNameame: “ << name;
cout << “nAge: “ << age;
}
Int main()
{
person p;
p.getdata();
p.display();
Return 0;
} //end of example
The output of program is:
Enter Name: Arun
Enter age:30
Name:Arun
Age: 30

Weitere ähnliche Inhalte

Was ist angesagt?

C++ OOP Implementation
C++ OOP ImplementationC++ OOP Implementation
C++ OOP ImplementationFridz Felisco
 
Basic structure of C++ program
Basic structure of C++ programBasic structure of C++ program
Basic structure of C++ programmatiur rahman
 
Object oriented programming c++
Object oriented programming c++Object oriented programming c++
Object oriented programming c++Ankur Pandey
 
FUNCTION IN C PROGRAMMING UNIT -6 (BCA I SEM)
 FUNCTION IN C PROGRAMMING UNIT -6 (BCA I SEM) FUNCTION IN C PROGRAMMING UNIT -6 (BCA I SEM)
FUNCTION IN C PROGRAMMING UNIT -6 (BCA I SEM)Mansi Tyagi
 
Function in c programming
Function in c programmingFunction in c programming
Function in c programmingSayeemAhmed8
 
Functions assignment
Functions assignmentFunctions assignment
Functions assignmentAhmad Kamal
 
C programming for Computing Techniques
C programming for Computing TechniquesC programming for Computing Techniques
C programming for Computing TechniquesAppili Vamsi Krishna
 
Functions in c language
Functions in c language Functions in c language
Functions in c language tanmaymodi4
 
SULTHAN's - C Programming Language notes
SULTHAN's - C Programming Language notesSULTHAN's - C Programming Language notes
SULTHAN's - C Programming Language notesSULTHAN BASHA
 
PROCEDURAL ORIENTED PROGRAMMING VS OBJECT ORIENTED PROGRAMING
PROCEDURAL ORIENTED PROGRAMMING VS OBJECT ORIENTED PROGRAMING PROCEDURAL ORIENTED PROGRAMMING VS OBJECT ORIENTED PROGRAMING
PROCEDURAL ORIENTED PROGRAMMING VS OBJECT ORIENTED PROGRAMING Uttam Singh
 
Modeling Aspects with AP&P Components
Modeling Aspects with AP&P ComponentsModeling Aspects with AP&P Components
Modeling Aspects with AP&P Componentsmukhtarhudaya
 
Introduction to Matlab Scripts
Introduction to Matlab ScriptsIntroduction to Matlab Scripts
Introduction to Matlab ScriptsShameer Ahmed Koya
 

Was ist angesagt? (19)

C++ OOP Implementation
C++ OOP ImplementationC++ OOP Implementation
C++ OOP Implementation
 
Basic structure of C++ program
Basic structure of C++ programBasic structure of C++ program
Basic structure of C++ program
 
Object oriented programming c++
Object oriented programming c++Object oriented programming c++
Object oriented programming c++
 
FUNCTION IN C PROGRAMMING UNIT -6 (BCA I SEM)
 FUNCTION IN C PROGRAMMING UNIT -6 (BCA I SEM) FUNCTION IN C PROGRAMMING UNIT -6 (BCA I SEM)
FUNCTION IN C PROGRAMMING UNIT -6 (BCA I SEM)
 
Function in c programming
Function in c programmingFunction in c programming
Function in c programming
 
Modular programming
Modular programmingModular programming
Modular programming
 
Introduction to F#
Introduction to F#Introduction to F#
Introduction to F#
 
Functions assignment
Functions assignmentFunctions assignment
Functions assignment
 
C++ ppt
C++ pptC++ ppt
C++ ppt
 
Function C programming
Function C programmingFunction C programming
Function C programming
 
C programming for Computing Techniques
C programming for Computing TechniquesC programming for Computing Techniques
C programming for Computing Techniques
 
Functions in c language
Functions in c language Functions in c language
Functions in c language
 
Programming in c
Programming in cProgramming in c
Programming in c
 
Problem solving methodology
Problem solving methodologyProblem solving methodology
Problem solving methodology
 
Fda unit 1 lec 1
Fda unit 1 lec  1Fda unit 1 lec  1
Fda unit 1 lec 1
 
SULTHAN's - C Programming Language notes
SULTHAN's - C Programming Language notesSULTHAN's - C Programming Language notes
SULTHAN's - C Programming Language notes
 
PROCEDURAL ORIENTED PROGRAMMING VS OBJECT ORIENTED PROGRAMING
PROCEDURAL ORIENTED PROGRAMMING VS OBJECT ORIENTED PROGRAMING PROCEDURAL ORIENTED PROGRAMMING VS OBJECT ORIENTED PROGRAMING
PROCEDURAL ORIENTED PROGRAMMING VS OBJECT ORIENTED PROGRAMING
 
Modeling Aspects with AP&P Components
Modeling Aspects with AP&P ComponentsModeling Aspects with AP&P Components
Modeling Aspects with AP&P Components
 
Introduction to Matlab Scripts
Introduction to Matlab ScriptsIntroduction to Matlab Scripts
Introduction to Matlab Scripts
 

Ähnlich wie Programming in c++

Principal of objected oriented programming
Principal of objected oriented programming Principal of objected oriented programming
Principal of objected oriented programming Rokonuzzaman Rony
 
Mca 2 sem u-1 iintroduction
Mca 2 sem u-1 iintroductionMca 2 sem u-1 iintroduction
Mca 2 sem u-1 iintroductionRai University
 
Lecture 1 uml with java implementation
Lecture 1 uml with java implementationLecture 1 uml with java implementation
Lecture 1 uml with java implementationthe_wumberlog
 
Bca 2nd sem u-1 iintroduction
Bca 2nd sem u-1 iintroductionBca 2nd sem u-1 iintroduction
Bca 2nd sem u-1 iintroductionRai University
 
A Hand Book of Visual Basic 6.0.pdf.pdf
A Hand Book of Visual Basic 6.0.pdf.pdfA Hand Book of Visual Basic 6.0.pdf.pdf
A Hand Book of Visual Basic 6.0.pdf.pdfAnn Wera
 
Software_Engineering_Presentation (1).pptx
Software_Engineering_Presentation (1).pptxSoftware_Engineering_Presentation (1).pptx
Software_Engineering_Presentation (1).pptxArifaMehreen1
 
Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org) (usef...
Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org)  (usef...Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org)  (usef...
Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org) (usef...Make Mannan
 
Introduction to object oriented language
Introduction to object oriented languageIntroduction to object oriented language
Introduction to object oriented languagefarhan amjad
 
Aspect Oriented Software Development
Aspect Oriented Software DevelopmentAspect Oriented Software Development
Aspect Oriented Software DevelopmentJignesh Patel
 
Object Oriented Programming using C++.pptx
Object Oriented Programming using C++.pptxObject Oriented Programming using C++.pptx
Object Oriented Programming using C++.pptxparveen837153
 
Cs6301 programming and datastactures
Cs6301 programming and datastacturesCs6301 programming and datastactures
Cs6301 programming and datastacturesK.s. Ramesh
 

Ähnlich wie Programming in c++ (20)

Principal of objected oriented programming
Principal of objected oriented programming Principal of objected oriented programming
Principal of objected oriented programming
 
OOP ppt.pdf
OOP ppt.pdfOOP ppt.pdf
OOP ppt.pdf
 
Mca 2 sem u-1 iintroduction
Mca 2 sem u-1 iintroductionMca 2 sem u-1 iintroduction
Mca 2 sem u-1 iintroduction
 
Lecture 1 uml with java implementation
Lecture 1 uml with java implementationLecture 1 uml with java implementation
Lecture 1 uml with java implementation
 
Part 1
Part 1Part 1
Part 1
 
Bca 2nd sem u-1 iintroduction
Bca 2nd sem u-1 iintroductionBca 2nd sem u-1 iintroduction
Bca 2nd sem u-1 iintroduction
 
T2
T2T2
T2
 
OOPS_Unit_1
OOPS_Unit_1OOPS_Unit_1
OOPS_Unit_1
 
1 puc programming using c++
1 puc programming using c++1 puc programming using c++
1 puc programming using c++
 
A Hand Book of Visual Basic 6.0.pdf.pdf
A Hand Book of Visual Basic 6.0.pdf.pdfA Hand Book of Visual Basic 6.0.pdf.pdf
A Hand Book of Visual Basic 6.0.pdf.pdf
 
Software_Engineering_Presentation (1).pptx
Software_Engineering_Presentation (1).pptxSoftware_Engineering_Presentation (1).pptx
Software_Engineering_Presentation (1).pptx
 
Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org) (usef...
Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org)  (usef...Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org)  (usef...
Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org) (usef...
 
Vedic Calculator
Vedic CalculatorVedic Calculator
Vedic Calculator
 
Topic 1 PBO
Topic 1 PBOTopic 1 PBO
Topic 1 PBO
 
Introduction to object oriented language
Introduction to object oriented languageIntroduction to object oriented language
Introduction to object oriented language
 
Aspect Oriented Software Development
Aspect Oriented Software DevelopmentAspect Oriented Software Development
Aspect Oriented Software Development
 
Documentation
DocumentationDocumentation
Documentation
 
Object Oriented Programming using C++.pptx
Object Oriented Programming using C++.pptxObject Oriented Programming using C++.pptx
Object Oriented Programming using C++.pptx
 
Cs6301 programming and datastactures
Cs6301 programming and datastacturesCs6301 programming and datastactures
Cs6301 programming and datastactures
 
PROBLEM SOLVING
PROBLEM SOLVINGPROBLEM SOLVING
PROBLEM SOLVING
 

Mehr von MalarMohana

Dynamics slideshare
Dynamics slideshareDynamics slideshare
Dynamics slideshareMalarMohana
 
Numerical analysis
Numerical analysis Numerical analysis
Numerical analysis MalarMohana
 
Statistics and operations research ppt
Statistics and operations research pptStatistics and operations research ppt
Statistics and operations research pptMalarMohana
 
Numerical analysis ppt
Numerical analysis pptNumerical analysis ppt
Numerical analysis pptMalarMohana
 

Mehr von MalarMohana (7)

Dynamics
Dynamics Dynamics
Dynamics
 
Dynamics slideshare
Dynamics slideshareDynamics slideshare
Dynamics slideshare
 
Dynamics
Dynamics Dynamics
Dynamics
 
Numerical analysis
Numerical analysis Numerical analysis
Numerical analysis
 
Statistics and operations research ppt
Statistics and operations research pptStatistics and operations research ppt
Statistics and operations research ppt
 
Numerical analysis ppt
Numerical analysis pptNumerical analysis ppt
Numerical analysis ppt
 
Dynamics
Dynamics Dynamics
Dynamics
 

Kürzlich hochgeladen

Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxnelietumpap1
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 

Kürzlich hochgeladen (20)

Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptx
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 

Programming in c++

  • 2.  The major motivating factor in the invention of object- oriented approach is to remove some of the flaws encountered in the procedural approach. OOP treats data as a critical element in the program development and does not allow it to flow freely around the system. It ties data more closely to the function that operate on it, and protects it from accidental modification from outside function. OOP allows decomposition of a problem into a number of entities called objects and then builds data and function around these objects. The data of an object can be accessed only by the function associated with that object. However, function of one object can access the function of other objects.
  • 3. It is necessary to understand some of the concepts used extensively in object-oriented programming. These include:  Objects  Classes  Data abstraction and encapsulation  Inheritance  Polymorphism  Dynamic binding  Message passing
  • 4. OOP offers several benefits to both the program designer and the user. Object- Orientation contributes to the solution of many problems associated with the development and quality of software products. The new technology promises greater programmer productivity, better quality of software and lesser maintenance cost. The principal advantages are:  Through inheritance, we can eliminate redundant code extend the use of existing Classes.  We can build programs from the standard working modules that communicate with one another, rather than having to start writing the code from scratch. This leads to saving of development time and higher productivity.  The principle of data hiding helps the programmer to build secure program that can not be invaded by code in other parts of a programs.  It is possible to have multiple instances of an object to co-exist without any interference.  It is possible to map object in the problem domain to those in the program.  It is easy to partition the work in a project based on objects.  The data-centered design approach enables us to capture more detail of a model can implemental form.  Object-oriented system can be easily upgraded from small to large system.  Message passing techniques for communication between objects makes to interface descriptions with external systems much simpler.  Software complexity can be easily managed.
  • 5. OOP has become one of the programming buzzwords today. There appears to be a great deal of excitement and interest among software engineers in using OOP. Applications of OOP are beginning to gain importance in many areas. The most popular application of object-oriented programming, up to now, has been in the area of user interface design such as window. Hundreds of windowing systems have been developed, using the OOP techniques. Real-business system are often much more complex and contain many more objects with complicated attributes and method. OOP is useful in these types of application because it can simplify a complex problem. The promising areas of application of OOP include:  Real-time system  Simulation and modeling  Object-oriented data bases  Hypertext, Hypermedia, and expertext  AI and expert systems  Neural networks and parallel programming  Decision support and office automation systems  CIM/CAM/CAD systems
  • 6. We have used the following #include directive in the program: #include <iostream>  The #include directive instructs the compiler to include the contents of the file enclosed within angular brackets into the source file. The header file iostream.h should be included at the beginning of all programs that use input/output statements.
  • 7. Namespace is a new concept introduced by the ANSI C++ standards committee. This defines a scope for the identifiers that are used in a program. For using the identifier defined in the namespace scope we must include the using directive, like Using namespace std; Here, std is the namespace where ANSI C++ standard class libraries are defined. All ANSI C++ programs must include this directive. This will bring all the identifiers defined in std to the current global scope. Using and namespace are the new keyword of C++.
  • 8.  In C++, main () returns an integer value to the operating system. Therefore, every main () in C++ should end with a return (0) statement; otherwise a warning an error might occur. Since main () returns an integer type for main () is explicitly specified as int. Note that the default return type for all function in C++ is int.
  • 9. AVERAGE OF TWO NUMBERS #include<iostream.h> // include header file Using namespace std; int main() { float number1, number2,sum, average; cin >> number1; // Read Numbers cin >> number2; // from keyboard sum = number1 + number2; average = sum/2; cout << ”Sum = “ << sum << “n”; cout << “Average = “ << average << “n”; return 0; } //end of example The output would be: Enter two numbers: 6.5 7.5 Sum = 14 Average = 7
  • 10.  One of the major features of C++ is classes. They provide a method of binding together data and functions which operate on them. Like structures in C, classes are user-defined data types.
  • 11. USE OF CLASS #include<iostream.h> // include header file using namespace std; class person { char name[30]; Int age; public: void getdata(void); void display(void); }; void person :: getdata(void) { cout << “Enter name: “; cin >> name; cout << “Enter age: “; cin >> age; } Void person : : display(void) { cout << “nNameame: “ << name; cout << “nAge: “ << age; } Int main() { person p; p.getdata(); p.display(); Return 0; } //end of example
  • 12. The output of program is: Enter Name: Arun Enter age:30 Name:Arun Age: 30