Project
Project
Project
DIRECTORY SYSTEM
Submitted by
SUBHASHREE.R
Register Number:
PRINCIPAL GUIDE
U.GANESH KUMAR K.SIVACHITRA
M.A., M.Ed., M.Phil., MBA, M.Sc., B.Ed.,
Chellappan Vidya Mandir Chellappan Vidya Mandir
International School International School
Karaikudi Karaikudi
EXTERNAL EXAMINER
2
DECLARATION
Date:
SUBH SHREE.R
3
ACKNOWLEDGEMENT
4
CONTENTS
5
CONTENTS
S.NO TITLE PAGE
NO.
1 ABSTRACT 7
2 INTRODUCTION 9
3 SYSTEM ENVIRONMENT 12
2.1. Hardware specifications 13
2.2. Software specifications 13
4 C++ Overview 15
2.3. OOP’s Concept 16
2.4.1. Class and Object 18
2.4.2. Inheritance 20
2.4.3. Function Overloading 21
2.4.4. Data Encapsulation 22
2.4.5. Data Abstraction 23
2.4.6. Data File and Streams 24
5 STUDY AND ANALYSIS OF 28
TELEPHONE DIRECTORY
SYSTEM
6 DESIGN AND DEVELOPMENT OF 35
TELEPHONE DIRECTORY SYSTEM
7 CONCLUSION 43
8 BIBLIOGRAPHY 45
9 SOURCE CODE 47
6
ABSTRACT
7
ABSTRACT
In this system we can add the new entries, view all the
available entries, modify the specified record and delete a
particular entry.
8
INTRODUCTION
9
INTRODUCTION
10
The background processing system will take care of all
processing task and maintain data integrity in order to reduce
the redundancy of data. For searching operation, users will
able to get any particular record using their contact or phone
number but the only condition is that, customers record must
be available within the file system. If no such record will be
available, proper error message will be displayed as per user
input provided to the system.
11
SYSTEM
ENVIRONMENT
12
SYSTEM ENVIRONMENT
Ram : 1.00 GB
13
C++
PROGRAMMING
14
2.3 Overview of C++
15
Features of Object Oriented C++
The main focus remains on data rather than procedures.
Object oriented programs are segmented into parts called
objects.
Data structures are designed to categorize the objects.
Data member and functions are tied together as a data
structure.
Data can be hidden and cannot be accessed by external
functions using access specifier.
Objects can communicate among themselves using
functions.
16
Standard Libraries in C++
C++ standard library was created after many years and it has
three important parts:
C++ core language provides all the building blocks
including data types, variables and literals etc.
The C++ Standard Library has rich set of methods to
manipulate files and strings.
The STL(Standard Template Library) provides a rich set
of template classes for manipulating data structures.
ANSI Standard for C++
ANSI stands for American National Standard Institute & the
ANSI standard began an attempt to ensure that C++ codes
become portable – that code written for Microsoft’s compiler
will compile without having any errors can run on compilers
of MAC or Linux or any other compiler. So, all major C++
compilers support the ANSI Standard.
LEARNING C++:
17
Uses of C++:
C++ is used by programmers to create computer software. It is
used to create general systems software, drivers for various
computer devices, software for servers and software for
specific applications and also widely used in the creation of
video games.
C++ is used by many programmers of different types and
coming from different fields. C++ is mostly used to
write device driver programs,
System software and applications that depend on
direct hardware manipulation under real time constraints. It is
also used to teach the basics of object oriented features
because it is simple and is also used in the fields of research.
Also, many primary user interfaces and system files of
Windows and Macintosh are written using C++. So, C++ is
really a popular, strong and frequently used programming
language of this modern programming era.
18
C++ CLASS DEFINITIONS
When you define a class, you define a blueprint for a data
type. This doesn’t actually define any data, but it does define
what the class name means, that is, what an object of the class
will consist of and what operations can be performed on such
an object.
A class definition starts with the keyword class followed
by the class name, and the class body, enclosed by a pair of
curly braces. A class definition must be followed either by a
semicolon or a list of declarations. For example, we defined
the Box data type using the keyword class as follows:
Class Box
{
Public:
double length; // Length of a box
double breadth; //Breadth of a box
double height; //Height of a box
};
The keyword public determines the access attributes of the
members of the class that follow it. A public member can be
accessed from outside the class anywhere within the scope of
the object class as private or protected which we will discuss
in a sub-section.
19
DEFINE C++ OBJECTS
Both of the objects Box1 and Box2 will have their own copy
of data members.
2.4.2. INHERITANCE
20
Base and Derived Classes
A class can be derived from more than one class, which
means it can inherit data and functions from multiple base
classes. To define a derived class, we use a class derivation
list to specify the base class (es). A class derivation list
names one or more base classes and has the form −
class derived-class: access-specifier base-class
Where access-specifier is one of public,
protected, or private, and base-class is the name of a
previously defined class. If the access-specifier is not used,
then it is private by default.
21
Function Overloading in C++
You can have multiple definitions for the same function name
in the same scope. The definition of the function must differ
from each other by the types and/or the number of arguments
in the argument list. You cannot overload function
declarations that differ only by return type.
22
C++ supports the properties of encapsulation and data hiding
through the creation of user-defined types, called classes. We
already have studied that a class can contain private,
protected and public members. By default, all items defined
in a class are private.
2.4.5 DATA ABSTRACTION
1 ofstream
This data type represents the output file stream and
is used to create files and to write information to
files.
2 ifstream
This data type represents the input file stream and is
used to read information from files.
3 fstream
This data type represents the file stream generally,
and has the capabilities of both ofstream and
ifstream which means it can create files, write
information to files, and read information from files.
To perform file processing in C++, header files <iostream>
and <fstream> must be included in your C++ source file.
24
OPENING A FILE
A file must be opened before you can read from it or write to
it. Either ofstream or fstream object may be used to open a
file for writing. And ifstream object is used to open a file for
reading purpose only.
Following is the standard syntax for open() function, which is
a member of fstream, ifstream, and ofstream objects.
void open(const char *filename, ios::openmode mode);
Here, the first argument specifies the name and location of
the file to be opened and the second argument of
the open() member function defines the mode in which the
file should be opened.
S.No Mode Flag & Description
1 ios::app
Append mode. All output to that file to be appended
to the end.
2 ios::ate
Open a file for output and move the read/write
control to the end of the file.
3 ios::in
Open a file for reading.
4 ios::out
Open a file for writing.
25
5 ios::trunk
If the file already exists, its contents will be
truncated before opening the file.
You can combine two or more of these values by ORing
them together. For example if you want to open a file in write
mode and want to truncate it in case that already exists,
following will be the syntax −
ofstream outfile;
outfile.open("file.dat", ios::out | ios::trunc );
Similar way, you can open a file for reading and writing
purpose as follows −
fstream afile;
afile.open("file.dat", ios::out | ios::in );
CLOSING A FILE
When a C++ program terminates it automatically flushes all
the streams, release all the allocated memory and close all the
opened files. But it is always a good practice that a
programmer should close all the opened files before program
termination.
Following is the standard syntax for close() function, which
is a member of fstream, ifstream, and ofstream objects.
void close();
WRITING TO A FILE
While doing C++ programming, you write information to a
file from your program using the stream insertion operator
(<<) just as you use that operator to output information to the
26
screen. The only difference is that you use
an ofstream or fstream object instead of the cout object.
You read information from a file into your program using the
stream extraction operator (>>) just as you use that operator
to input information from the keyboard. The only difference
is that you use an ifstream or fstream object instead of
the cin object.
27
STUDY AND ANALYSIS OF
TELEPHONE DIRECTORY
SYSTEM
28
SYNOPSIS
Purpose:
Scope:
29
OBJECTIVES
APPLICANTS
30
GOALS OF A NEW SYSTEM
31
SOFTWARE SPECIFICATION
C-PROGRAMMING
C++- PROGRAMMING
32
PROBLEM DEFINITION
Existing System
Proposed System
In order to eliminate the drawbacks of the existing system, a
system has been developed due to which the person need not
spend much time in identify a phone number and instead
database is built that takes care of every transaction thereby
reducing the burden on customer.
33
By using this proposed system we can reduce the problems of
existing system
In this proposed system we can modify the customers name
and his/her contact number details, searching, viewing and
deleting contacts is also possible.
Searching for contact number is takes less time.
34
DESIGN AND DEVELOPMENT
OF TELEPHONE DIRECTORY
SYSTEM
35
SYSTEM DESIGN:
Hardware Requirements:
Mouse : Optical
Software Requirements:
OUTPUT
37
39
40
41
42
CONCLUSION
43
CONCLUSION;-
44
BIBLIOGRAPHY
45
BIBLIOGRAPHY
1.https://code-projects.org/telephone- directory-in-c++-with-
sourcecode/
2.https://www.scribd.com/doc/134832923/source-code-for-
telephone-system-in-c++
3.https://en.wikipedia.org/wiki/telephone-information-on-
system
46
SOURCE CODE
47
SOURE CODE
#include<iostream.h>
#include<fstream.h>
#include<iomanip.h>
#include<string.h>
#include<stdlib.h>
#include<conio.h>
#include<stdio.h>
#include<iomanip.h>
#include<graphics.h>
#include<dos.h>
class stud
{
public:
char name[20];
char address[20];
48
void get(void);
void show(void);
void modify(void);
};
void stud::get(void)
int i=0;
cin.get(name[i]);
while(name[i]!='\n')
{
i=i+1
cin.get(name[i]);
}
cin.getline(name,20,'\n');
cin.getline(address,20,'\n');
fflush(stdin);
fflush(stdin);
void stud::show(void)
cout<<"\n";
void main()
int x,y;
int midx,midy;
getch();
closegraph();
}
y:
char*pass="RPV";
char*ppass;
gotoxy(25,8);
int size=7;
settextstyle(7,0,size);
setbkcolor(BLUE);
setcolor(WHITE);
outtextxy(180,50,"WELCOME" );
51
setcolor(WHITE);
outtextxy(250,200,"TO");
settextstyle(8,0,5);
setfillstyle(1,DARKGRAY);
setcolor(WHITE);
outtextxy(60,350,"\n\nTELEPHONE DIRECTORY");
getch();
clearviewport();
settextstyle(3,0,4);
settextstyle(7,0,4);
getch();
clearviewport();
g:
if(strcmpi(pass,ppass)!=0)
{
cout<<"\n\t\t\tIncorrect password";
cout<<"\n\t\t\tTry again";
52
getchar();
goto g;
}
else
{
stud s;
char name[20];
char name1[20];
int ch;
clrscr();
setbkcolor(BLUE);
setcolor(YELLOW);
closegraph();
z:
cout<<"\n\n\n\n\n\n\n\n\n";
initgraph(&gdriver, &gmode,"c:\\turboc3\\bgi");
setcolor(BLUE);
rectangle(60,10,600,400);
53
setfillstyle(1,YELLOW);
bar(61,11,599,399);
settextstyle(TRIPLEX_FONT ,HORIZ_DIR,4);
setcolor(BLUE);
settextstyle(TRIPLEX_FONT,HORIZ_DIR,4);
setcolor(BLUE);
settextstyle(TRIPLEX_FONT,HORIZ_DIR,4);
setcolor(BLUE);
settextstyle(TRIPLEX_FONT,HORIZ_DIR,4);
gotoxy(62,23);
cin>>ch;
switch(ch)
{
case 1: //responsible for addition of record
{
clrscr();
fstream f;
f.open("rec",ios::in|ios::out|ios::ate|ios::app|ios::binary);
char ans;
s.get();
f.write((char *)&s,sizeof(s));
clrscr();
outtextxy(250,360, " Do you want to continue:- ");
ans=getche();
if(ans=='Y' || ans=='y'){goto z;}
f.close();
break;
}
case 2: // will show all the contents of the file
{
clrscr();
cout<<"\n\n";
fstream f;
55
f.open("rec",ios::in|ios::out|ios::ate|ios::app|ios::binary);
f.seekg(0);
int ctr=0;
while(f.read((char *)&s,sizeof(s)) )
{
ctr=ctr+1;
if(f.eof()==1)
{break;}
}
f.close();
outtextxy(240,350, " Do you want to continue :-");
char ans;
ans=getche();
if(ans=='y'|| ans=='Y'){
closegraph();
goto z;}else{exit(1);}
case 3: // search
{
gotoxy(60,25);
clearviewport();
56
rectangle(10,10,630,470);
setbkcolor(DARKGRAY);
textbackground(3);
textcolor(5);
clrscr();
char ans;
ifstream f;
stud s;
char name[20];
char address[20];
unsigned int ph_no;
f.open("rec",ios::in|ios::binary);
cout<<"\n\n\n Enter name whose record to be search :";
cin>>name;
do
{
f.read((char *)&s,sizeof(s));
if(f.eof()==1) {break;}
if(strcmpi(s.name,name)==0)
{
cout<<"\n Name :"<<s.name;
cout<<"\n address :"<<s.address;
cout<<"\n phone_no :"<<s.ph_no;
getchar();
}
}while(f);
f.close();
settextstyle(7,0,1);
outtextxy(250,410,"Do You Want To Continue:");
ans=getchar();
if(ans=='Y'||ans=='y')
goto z;
else
{ 57
closegraph();
break;
}
if(s.ph_no==ph_no)
{
cout<<"\n Current Name :"<<s.name;
cout<<"\n Current Address
:"<<s.address;
cout<<"\n Current Phone No :"<<s.ph_no;
getchar();
cout<<"\n Enter the new name :";
cin>>name;
cout<<"\n Enter the city :";
cin>>address;
cout<<"\n Enter new ph_no :";
cin>>ph_no;
strcpy(s.name,name);
58
strcpy(s.address,address);
s.ph_no=ph_no;
int l=f.tellg();
f.close();
f.open("rec",ios::out|ios::binary|ios::ate);
f.seekg(l-sizeof(s));
f.write((char *)&s,sizeof(s));
}
}while(f);
f.close();
outtextxy(290,360, " Do you want to continue :-");
ans=getche();
if(ans=='Y'||ans=='y')
{goto z;}
break;
}
fflush(stdin);
fflush(stdout);
cin.getline(name,20,'\n');
while(fin)
{
fin.read((char *)&s,sizeof (s));
if(strcmp(s.name,name)==0)
{fout.read((char *)&s,sizeof(s));
}
else
{if(fin.eof()==1) {break;}fout.write((char *)&s,si }
}
fin.close();
fout.close();
system("del rec");
system("ren va rec");
cout<<"\n Enter is get Deleted:-";
getchar();
char ans;
outtextxy(240,340, " Do you want to continue:- ");
ans=getche();
if (ans=='y' || ans=='Y')
{goto z;}
else
if (ans=='n' || ans=='N')
60
{getchar();
exit(1);
} }
case 6:
{
clearviewport();
outtextxy(250,360,"THE END OF THE PROJECT:-");
outtextxy(260,390,"\n \n\n\n\n PLEASE PRESS ENTER");
getchar();
closegraph();
exit(1);
}
default:
goto z;
}
}
61