project on c++
TRANSCRIPT
-
7/30/2019 Project on C++
1/16
Click to edit Master subtitle style
12/9/1
2
Project on C++
Submittedby:-
Divya Rai
ECE(3rd yr)
11
Submitted to :-
Neha Mangla
SATYA COLLEGE OF
ENGINEERING & TECHNOLOGY
-
7/30/2019 Project on C++
2/16
12/9/12
Contents:-
History of C++
Object Oriented Programming
Features of OOP OOP Characteristics
The basics of C++ Program
Data types and Expression
Operators
Conditional Constructs
22
-
7/30/2019 Project on C++
3/16
12/9/1
2
History of C++
C++ developed by Bjarne Stroustrup at AT&TBell Labs in the 1980s.
Overcame several shortcomings of C
Incorporated object oriented programming
C remains a subset of C++
33
-
7/30/2019 Project on C++
4/16
12/9/1
2
Object Oriented Programming
The major motivating factor in the invention ofthe object oriented approach is to remove someflaws encountered in the procedural approach.
OOP treats data as a critical element in theprogram development and does not allow it flowfreely around the system.
It ties data more closely to the functions thatoperate on it, and protects it from accidentalmodification from outside functions.
OOP allows decomposition of a problem into anumber of entities called objects and then builds
44
-
7/30/2019 Project on C++
5/16
12/9/1
2
Features of OOP
Emphasis is on data rather thanprocedure.
Programs are divided into what are knownas objects.
Functions that operate on the data of an
object are tied together in the datastructure.
Data is hidden and cannot be accessed by
external functions .
55
-
7/30/2019 Project on C++
6/16
12/9/1
2
OOP Characteristics
Encapsulation
Information hiding
Objects contain their own data and algorithms
Inheritance
Writing reusable codeObjects can inherit characteristics from
other objects
Polymorphism
66
-
7/30/2019 Project on C++
7/16
12/9/1
2
The Basics of a C++ Program
Programming language
a set of rules, symbols, special words
Rules syntax specifies legal instructions
Symbols
special symbols ( + - * ! )Word symbols
reserved words
(int, float, double, char )
77
-
7/30/2019 Project on C++
8/16
12/9/1
2
Example Program
#include
int main()
{
cout
-
7/30/2019 Project on C++
9/16
12/9/1
2
Data Types and Expression
Simple data types include
Integers
Floating point
Enumeration
An expression includes
constants
variables
function calls
combined with operators 99
-
7/30/2019 Project on C++
10/16
12/9/1
2
Operators
Arithmetic operators(+,-,*,/,%,^)
Arithmetic assignment operators(e.g. x+=y)
Unary operators(e.g. x++,x--) Comparison operators(e.g. x>y)
Logical operators(&&,||)
10
10
-
7/30/2019 Project on C++
11/16
12/9/1
2
Conditional Constructs
If .else construct
Switch ..case construct
IF .else construct:-IF conditional construct is followed by logical
expression where data is compared and decision ismade based on the result of the comparison .
Syntax
if(exp.)
{statements;}
11
11
-
7/30/2019 Project on C++
12/16
12/9/1
2
Conditional Constructs(contd)
Switch ..case constructs
When the switch statement is executed itscondition variable is evaluated and compared with
each case constants .
Syntax
switch (variable _name)
{
case 1:
Statements;
12
12
-
7/30/2019 Project on C++
13/16
12/9/1
2
Loop constructs
A loop is construct that causes a section of aprogram to be repeated a certain no. of times.
The while Loop
The do.while Loop
The for Loop Construct
The break and continue StatementsThe while Loop:-
The while loop continues until the evaluating
condition becomes false.
13
13
-
7/30/2019 Project on C++
14/16
12/9/1
2
Loop Constructs contd.
Do ..while Loop:-
In do ..while loop the body of the loop isexecuted at least once and the condition is
evaluated for subsequent executions.
Syntax:-
do
{statements;}
while(conditions);14
14
-
7/30/2019 Project on C++
15/16
12/9/1
2
Loop Constructs contd.
For loop constructs:-
The for loop constructs provides a compact way ofspecifying the statements that control the repetition of
steps within the loop.
Syntax:-
For (initialization;condition;increment/decrement)
{statements;}
15
15
-
7/30/2019 Project on C++
16/16
12/9/1
2
ThankYou
16
16