Professional Documents
Culture Documents
AISSCE - 2020: The Velammal International School
AISSCE - 2020: The Velammal International School
AISSCE – 2020
2019-2020
THE VELAMMAL INTERNATIONAL SCHOOL
CERTIFICATE
Date: __________
2
ACKNOWLEDGEMENT
Last but not the least I thank all my friends who helped me in
the completion of this project.
3
OBJECT – ORIENTED PROGRAMMING PARADIGM
4
BENEFITS OF OOP:
Through inheritance, we can eliminate redundant code and extend the use of
exiting.
classes
Data hiding helps the programmer to build secure programs that cannot be
invaded by code in other parts of the program.
It is easy to partition the work in a project based on objects.
Object oriented systems can be easily upgraded from small to large systems.
Software complexity can be easily managed
It returns the used memory in constructor through destructor.
Message passing (Invoke a variable or function in the receiving object that
generates the desired result).
Function overloading (same function name and different argument)
Pointers (secure programs as well as memory saving)
ABSTRACTION:
Abstraction refers to the act of representing essential features without including the
background details or explanations.
REAL LIFE ENTITY:
“Switch Board” – we need to know only its essential features that is what all
switches are to be pressed and the background details like wiring and circuitry are
hidden from us.
class Account
{
int accont_no; char type; float balance;
float deposit ( float amount )
{
balance = balance + amount; return balance;
}
float withdraw ( float amount )
5
{
balance = balance - amount; return balance;
}
};
void main( )
{ Account A1;
A1.deposit ( 2000 );
A1.withdraw ( 1000 );}
In this program we access deposit and withdraw functions without including the
manipulation.
ENCAPSULATION:
Encapsulation refers to wrapping up data and associated functions into one single
unit.
class Account
{
int accont_no;
float balance;
float deposit ( float amount )
{
char type;
balance = balance + amount;
return balance;
}
float withdraw ( float amount )
{
balance = balance - amount;
return balance;
}
};
6
void main( )
{
Account A1;
A1.deposit ( 2000 );
A1.withdraw ( 1000 );
}
In this program we wrap type of deposit in deposit function
DATA HIDING:
The class groups its members ( data & functions ) into three sections : private,
protected and public, where private & protected members remain hidden from
outside world and thereby support data- hiding.
MODULARITY:
INHERITANCE:
7
5. Hierarchical inheritance - When many subclasses inherits from one base class.
POLYMORPHISM:
Polymorphism is the ability for a message or data to be processed in more than one
form. Polymorphism is a property by which the same message can be sent to objects
of several different classes.
C++ CHARACTER SET:
Letters A – Z, a – z
Digits 0–9
White Space Blank space, Horizontal tab ( ), Carriage return, New line
TOKENS
The smallest individual unit in a program is known as a Token. C++ has five tokens.
1. Keyword
2. Identifiers
3. Literals
4. Punctuations
5. Operators
KEYWORD:
These are the words that convey a special meaning to the language compiler.
Example: for, do, while, int, char, it, etc….
IDENTIFIERS:
An identifier is an arbitrarily long sequence of letters and digits. The first character
must be a letter. The underscore (_) counts as a letter. Upper and lower case letters
are different. All characters are significant.
Example: myfile, dat_name, z2, etc …
8
LITERALS:
Literals are data items that never change their value during a program run.
Integer – constants : Whole numbers ( 1, 20,…)
Character – constants : One character contained enclosed in single quotation
marks( ‘a’, ‘4’,….)
Floating – constants : Numbers having fractional parts. (1.12, 17.5,….)
String – constants : One or more characters contained enclosed in double
quotation marks. ( “a”, “welcome”,….)
PUNCTUATIONS:
These characters enhance a program’s readability and give proper meaning to
statements.
( [ ] ( ) { } , ; : * …. = # )
OPERATORS:
Operators are tokens that trigger some computation or action when applied to
variables and other objects in an expression.
( +, <= , != , etc….)
FORMATTING OUTPUT:
9
Array - An array is a collection of variables of the same type that are referenced by
a common name.
Structure - A structure is a collection of variables referenced under one name but
different data types.
Function – A function is a named part of a program that can be invoked from other
parts of the program as often needed.
Pointer – A pointer is a variable that holds a memory address. This address is
usually the location of another variable in memory.
Classes – A class contains related variables and functions together.
VARIABLES:
Variables represent named storage locations whose values can be manipulated during
program run.
Memory space :
ARRAYS:
Arrays are a way to group a number of items into a larger unit. Arrays can have data
items of simple types like int, char or even of user – defined types like structures and
objects.
An array is a collection of variables of the same type that are referenced by a
common name.
10
Types:
1. One dimensional arrays ( int a[10] )
2. Two dimensional arrays ( int a[3][10] )
3. Multi dimensional arrays ( int a[3][2][5] )
Example:
int a[10];
for(int i = 1; i < =10; i ++ )
cin>>a[i];
STRUCTURE:
The above declaration declares a structure named student with structure elements
rollno, name, class, marks and grade. The last line create structure objects are s1,s2.
CLASS:
A class is a way to bind the data describing an entity and its associated functions
together.
In C++, class makes a data type that is used to create objects of this type.
class Account
{
11
int account_no;
char type;
float balance;
float deposit ( float amount )
{
balance = balance + amount;
return balance;
}
float withdraw ( float amount )
{
balance = balance - amount;
return balance;
}
};
OBJECT:
void main( )
{
Account A1;
A1.deposit ( 2000 );
A1.withdraw ( 1000 );
}
IF STATEMENT:
Simple if statement
If….else statement
12
SIMPLE IF STATEMENT:
if ( test expression)
{
Statement 1;
Statement 2;
}
if ( test expression)
{
Statement 1;
}
else
{
Statement 2;
}
If Else Construct – if statement with test expression, if the test expression
evaluates to true then Statement 1 only displayed, if the test expression evaluates to
false then Statement 2 only displayed.
SWITCH STATEMENT:
13
FOR LOOP:
The for loop is an entry – controlled loop and is used when an action is to be
repeated for a predetermined number of times.
Syntax
for (initial value; test; increment or decrement)
{
action 1;
}
action 2;
WHILE LOOP:
While loop is executed only when the test condition is true, if it is false, it will come
out of the loop. It has no initialization expression or increment expression.
Syntax
14
while (test expression)
action 2;
BREAK:
The break statement enables a program to skip over part of the code. A break
statement terminates the smallest enclosing while, do – while, for or switch
statement.
Syntax
break;
A break statement skips the rest of the loop and jumps over to the statement
following the loop.
Example
FILES:
Most computer programs work with files. This is because files help in storing
information permanently.
In C++, file input/output facilities are implemented through a fstream.h header file.
It defines certain classes that help one perform file input and output.
15
Example: write and read of a text file
void main()
{
char ch;
clrscr();
ofstream fout("student.txt",ios::out);
char name[30];
for(int i=0;i<5;i++)
{
cout<<"Enter Five Names :";
cin.get(name,30);
cout<<"\n";
cin.get(ch);
fout<<name<<'\n';
}
fout.close();
ifstream fin("student.txt",ios::in);
fin.seekg(0);
for(i=0;i<5;i++)
{
fin.get(name,30);
fin.get(ch);
cout<<"Names are :"<<name<<endl;
}
fin.close();
getch();
}
16
RANDOM ACCESS:
seekg( ) - will move the get_pointer to the specified byte in the file.
Example:
seekg(0) - move the get_pointer to the staring location.
seekp( ) - will move the put_pointer to the specified byte in the file.
Example:
seekp(0) - move the put_pointer to the staring location.
Tellg( ) and tellp( ) ( return positon of pointer) works in the same way as seekg( )
and seekp( ).
FILE COMMANDS:
To seek a rollno
HEADER FILES:
17
#include<stdio.h> - Defines types and macros needed for the
Standard I/O Package defined in Kernighan and
Ritchie and extended under UNIX System V.
Defines the standard I/O predefined streams
stdin, stdout, stdprn, and stderr, and declares
stream-level I/O routines.
#include<process.h> - Contains structures and declarations for the
spawn... and exec... functions.
#include<fstream.h> - Declares the C++ stream classes that support file
input and output.
PROCESS FUNCTION:
18
BIBLIOGRAPHY
BOOKS AUTHORS
19