Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 16

12/9/12

SATYA COLLEGE OF ENGINEERING & TECHNOLOGY

Project on C++
Submitted to :Neha Mangla by:11 Click to edit Master subtitle style

Submitted

Divya Rai ECE(3rd yr)

12/9/12

Contents:
22

History of C++ Object Oriented Programming Features of OOP OOP Characteristics The basics of C++ Program Data types and Expression Operators Conditional Constructs

12/9/12

History of C++
C++

developed by Bjarne Stroustrup at AT&T Bell Labs in the 1980s.


Overcame

several shortcomings of C object oriented programming

Incorporated C

remains a subset of C++

33

12/9/12

Object Oriented Programming


The

major motivating factor in the invention of the object oriented approach is to remove some flaws encountered in the procedural approach. treats data as a critical element in the program development and does not allow it flow freely around the system. ties data more closely to the functions that operate on it, and protects it from accidental modification from outside functions. allows decomposition of a problem into a number of entities called objects and then builds

OOP

It

OOP

44

12/9/12

Features of OOP
Emphasis

is on data rather than procedure. are divided into what are known as objects. that operate on the data of an object are tied together in the data structure. is hidden and cannot be accessed by external functions .
55

Programs

Functions

Data

12/9/12

OOP Characteristics
Encapsulation
Information Objects

hiding

contain their own data and algorithms

Inheritance
Writing Objects

reusable code

can inherit characteristics from other objects


66

Polymorphism

12/9/12

The Basics of a C++ Program


Programming a

language

set of rules, symbols, special words

Rules syntax Symbols special Word

specifies legal instructions

symbols ( +

! )

symbols
words
77

reserved (int,

float, double, char )

12/9/12

Example Program
#include <iostream> int main() { cout<<"Welcome to C++ Programming"<<endl; return 0; }

Welcome to C++ Programming


88

Program Output

12/9/12

Data Types and Expression


Simple

data types include


point

Integers Floating

Enumeration An

expression includes

constants variables function

calls with operators


99

combined

12/9/12

Operators
Arithmetic Arithmetic Unary

operators(+,-,*,/,%,^) assignment operators(e.g. x+=y)

operators(e.g. x++,x--) operators(e.g. x>y)

Comparison Logical

operators(&&,||)

10 10

12/9/12

Conditional Constructs
If

.else construct ..case construct

Switch

IF .else construct:IF conditional construct is followed by logical expression where data is compared and decision is made based on the result of the comparison . Syntax if(exp.) {statements;}
11 11

12/9/12

Conditional Constructs(contd)
Switch

..case constructs

When the switch statement is executed its condition variable is evaluated and compared with each case constants . Syntax switch (variable _name) { case 1: Statements;
12 12

12/9/12

Loop constructs
A loop is construct that causes a section of a program to be repeated a certain no. of times.
The The The The

while Loop do.while Loop for Loop Construct break and continue Statements

The while Loop:The while loop continues until the evaluating condition becomes false.
13 13

12/9/12

Loop Constructs contd.


Do ..while Loop:In do ..while loop the body of the loop is executed at least once and the condition is evaluated for subsequent executions. Syntax:do {statements;} while(conditions);

14 14

12/9/12

Loop Constructs contd.


For

loop constructs:-

The for loop constructs provides a compact way of specifying the statements that control the repetition of steps within the loop. Syntax:-

For (initialization;condition;increment/decrement)
{statements;}
15 15

12/9/12

Thank You
16 16

You might also like