17

computer investigatory report on "Telephone Management"

Embed Size (px)

DESCRIPTION

complete investigatory report work on "TELEPHONE MANAGEMENT"

Citation preview

Page 1: computer investigatory report on "Telephone Management"
Page 2: computer investigatory report on "Telephone Management"

PROJECT GUIDE

MR. KAPIL SAINI

{SUBJECT TEACHER}

SUBMITTED FROM

SAMYAK SAU

{ Xii TH ‘A’ (Sc.) }

Roll no.

Page 3: computer investigatory report on "Telephone Management"

Mr. Kapil Saini

(Lecturer in Comp. Sc.)

This to certify that the project report entitled “TELEPHONE MANAGEMENT” submitted by SAMYAK SAU during the academic year 2010 – 2011 is a bonafied piece of work conducted under my supervision and guidance. The data sources have been dully acknowledged.

I wish his success in all his future endeavours.

Mr. P.C Prashar

(Principal)

Supervised by:

Page 4: computer investigatory report on "Telephone Management"

I take this opportunity to express my profound sense of gratitude and respect to all those who helped me throughout this venture.

I owe my regards to Mr. P.C Prashar, Principal K.V No.1 (AFS) Pathankot for his cooperation and valuable support and for giving me the opportunity to undertake this project work and providing the necessary infrastructure.

I would like to express my heartfelt thanks to my revered teacher and guide Mr. Kapil Saini for his valuable guidance, encouragement and support throughout my studentship under him at the institute. This project is his visualization and owes a lot of its functionality to him.

Last but not the least; I owe my overwhelming gratitude to my family and friends who gave me constant support and motivation to continue with this endeavour.

SAMYAK SAU XII ‘A’

Mr. P.C Prashar

(Principal)

Page 5: computer investigatory report on "Telephone Management"

The computers have gained a lot of importance in the past five decades. Most of our day-to-day jobs are being influenced by the use of computers. Now a day, computers are used for performing almost every function, which were performed by humans in the past. In some areas such as science and technology, targets can’t be achieved without the use of computers. The characteristics the make the computer so important includes its extra ordinary speed, large storage capacity, accuracy and consistency.

Today computers play a great role in various industries and a large numbers of industries are using computer for various applications such as maintaining cashbook, sales book, purchase book, and other books of accounts. Computer can also be used for the designing of the various products. Computers provide many options for the designing of products.

In this project report, steps have been taken for computerizing Telephone Management System. The analysis of the project has been

Page 6: computer investigatory report on "Telephone Management"

undertaken with utmost sincerity and honesty and we will be extremely satisfied if the effort is appreciated.

Page 7: computer investigatory report on "Telephone Management"
Page 8: computer investigatory report on "Telephone Management"

Developed At: - Kendriya Vidyalaya no.1 (AFS), Pathankot

Affiliated to CENTRAL BOARD OF SECONDARY EDUCATION New Delhi.

//PROGRAM TO MAINTAIN THE TELEPHONE DIRECTORY#include <iostream.h>#include <fstream.h>#include <conio.h>#include <string.h>#include <stdio.h>struct person

{

Tools Used

Front end: - C++

Page 9: computer investigatory report on "Telephone Management"

long record_id;char person_name[20];char res_address[30];long res_phone;long off_phone;char occu[10];

};person pers;long getrec_no();void add_object();void get_data();void modify_object();void mod_data(long r);void show_data();void del_object();void search_object();void reports();

void main(){

int ch;do{

clrscr();cout<<”MADE BY SAMYAK SAU”;cout<<”\n\nTELEPHONE DIRECTORY :”<<endl;cout<<”\n***************************************”<<endl;cout<<”\nMAIN MENU”<<endl;cout<<”\n=======================================\n”<<endl;cout<<”\n1. ADD RECORDS:”;cout<<”\n2. MODIFY RECORDS:”;cout<<”\n3. DELETE RECORDS:”;cout<<”\n4. SEARCH RECORDS:”;cout<<”\n5. REPORTS:”;cout<<”\n6. EXIT:”;cout<<”\n=======================================”<<endl;cout<<”\n ENTER THE CHOICE: ”;cin>>ch;

switch(ch){

case 1: add_object();break;

case 2: modify_object();break;

case 3: del_object();break;

case 4: search_object();break;

case 5: reports();break;

case 6: clrscr();break;

default: cout<<”\nWORNG CHOICE………… TRY AGAIN\n”;}

}

while(ch!=6);}

//FUNCTION FOR ADDITION FOR RECORDS

void add_object(){

ofstream file;char ch=’Y’;while(ch==’y’||ch==’Y’)

{file.open(“phone.dat”,ios::app);get_data();file.write((char*)&pers,sizeof(pers));

Page 10: computer investigatory report on "Telephone Management"

file.flush();file.close();cout<<”\nWANT TO ADD MORE RECORDS (Y/N): ”;cin>>ch;

}}

void get_data(){

clrscr();cout<<”MADE BY SAMYAK SAU”;cout<<”\n\nTELEPHONE DIRECTORY :”<<endl;cout<<”\n***************************************”<<endl;cout<<”\nADDITION\n”;cout<<”\n=======================================\n”<<endl;pers.record_id=getrec_no();cout<<”RECORD ID: ”<<pers.record_id;cout<<”\nENTER THE NAME: ”;gets(pers.person_name);cout<<”\nRESIDENTIAL ADDRESS: ”;gets(pers.res_address);cout<<”\nRESIDENTIAL PHONE: ”;cin>>pers.res_phone;cout<<”\nENTER THE OCCUPATION: ”;gets(pers.occu);cout<<”\nENTER THE OFFICE PHONE NUMBER: ”;cin>>pers.off_phone;

}long getrec_no()

{long rec_no=0;ifstream file;file.open(“phone.dat”,ios::in);while(file.read((char*)&pers,sizeof(pers)))

{rec_no++;

}file.close();return rec_no;

}

//FUNCTION FOR MODIFICATION OF RECORDS

void modify_object(){

fstream file;int n=0;long rec;char ans;cout<<”\nENTER RECORDS ID TO MODIFIED: ”;cin>>rec;file.open(“phone.dat”,ios::in|ios::out);file.seekg(0,ios::beg);file.read((char*)&pers,sizeof(pers));n++;while(!file.eof())

{if(pers.record_id==rec)

{show_data();cout<<”\n=======================================\n”<<endl;cout<<”Want To Update This Record (Y/N): ”;cin>>ans;if(ans==’y’||ans==’Y’)

{cout<<”\nModified Values Are:”;file.seekp((n-1)*sizeof(pers),ios::beg);mod_data(rec);cout<<n<<endl;file.write((char*)&pers,sizeof(pers));cout<<”\nRecord Modified……………….”;

Page 11: computer investigatory report on "Telephone Management"

cout<<”\n=======================================\n”<<endl;cout<<”\nPress any key to continue…………………….”;getch();

file.flush();break;

}}

else{

file.read((char*)&pers,sizeof(pers));n++;

}}

}

//FUNCTION FOR DELETING OF RECORDS

void mod_data(long r){

clrscr();cout<<”MADE BY SAMYAK SAU”;cout<<”\n\nTELEPHONE DIRECTORY :”<<endl;cout<<”\n***************************************”<<endl;cout<<”\nUPDATION:\n”;cout<<”\n=======================================\n”<<endl;pers.record_id=r;cout<<”Record ID ”<<pers.record_id;cout<<”\nEnter The Name: ”;gets(pers.person_name);cout<<”\nResidential Address: ”;gets(pers.res_address);cout<<”\nResidential Phone No: ”;cin>>pers.res_phone;cout<<”\nEnter The Occupation: ”;gets(pers.occu);cout<<”\nEnter The Office Phone Number: ”;cin>>pers.off_phone;

}void show_data()

{clrscr();cout<<”MADE BY SAMYAK SAU”;cout<<”\n\nTELEPHONE DIRECTORY :”<<endl;cout<<”\n***************************************”<<endl;cout<<”\nDISPLAY DATA:\n”;cout<<”\n=======================================\n”<<endl;cout<<”Record Id: ”<<pers.record_id;cout<<”\nName of the person: ”<<pers.person_name;cout<<”\nResidential address: ”<<pers.res_address;cout<<”\nResidential phone: ”<<pers.res_phone;cout<<”\nOccupation: ”<<pers.occu;cout<<”\nOffice phone: ”<<pers.off_phone;

}void del_object()

{long rec_no;fstream file1,file2;clrscr();cout<<”MADE BY SAMYAK SAU”;cout<<”\n\nTELEPHONE DIRECTORY :”<<endl;cout<<”\n***************************************”<<endl;file1.open(“phone.dat”,ios::in);file2.open(“temp.dat”,ios::app);cout<<”\nDELETE RECORDS\n”;cout<<”\n=======================================\n”<<endl;cout<<”Enter the record Id to be removed: ”;cin>>rec_no;file1.read((char*)&pers,sizeof(pers));int i,j;while(file1.read((char*)&pers,sizeof(pers)))

{

Page 12: computer investigatory report on "Telephone Management"

if(rec_no!=pers.record_id)file2.write((char*)&pers,sizeof(pers));

else{

show_data();}

file2.flush();}

cout<<”\n=======================================\n”<<endl;cout<<”\nWant To Delete Your Records (Y/N): ”;char ans;cin>>ans;if(ans==’n’||ans==’N’)

{return;

}file1.close();file2.close();remove(“phone.dat”);rename(“temp.dat”,”phone.dat”);

}

//FUNCTION FOR TO SEARCH RECORDS

void search_object(){

fstream file;int count=0;long rec;long phno=0;char name[20];int ch;do

{clrscr();cout<<”MADE BY SAMYAK SAU”;cout<<”\n\nTELEPHONE DIRECTORY :”<<endl;cout<<”\n***************************************”<<endl;cout<<”\nSEARCH MENU:”<<endl;cout<<”\n=======================================\n”<<endl;cout<<”1. Record ID: ”<<endl;cout<<”2. NAME: “<<endl;cout<<”3. PHONE NO: “<<endl;cout<<”4. Exit: “<<endl;cout<<”\n=======================================\n”<<endl;cout<<”Enter the field to be searched: ”;cin>>ch;switch(ch)

{case 1: cout<<”\nEnter the record id to be searched: “;

cin>>rec;file.open(“phone.dat”,ios::in);file.seekg(0,ios::beg);file.read((char*)&pers,sizeof(pers));while(!file.eof())

{if(pers.record_id==rec)

{count++;show_data();getch();

}file.read((char*)&pers,sizeof(pers));

}file.close();cout<<”\n=======================================\n”<<endl;cout<<”\nRecord Found: “<<count;getch();break;

case 2: clrscr();

Page 13: computer investigatory report on "Telephone Management"

cout<<”MADE BY SAMYAK SAU”;cout<<”\n\nTELEPHONE DIRECTORY :”<<endl;cout<<”\n***************************************”<<endl;cout<<”\nEnter the person name to be searched: “;gets(name);file.open(“phone.dat”,ios::in);file.seekg(0,ios::beg);file.read((char*)&pers,sizeof(pers));while(!file.eof())

{if(strcmp(name,pers.person_name)==0)

{count++;show_data();getch();

}file.read((char*)&pers,sizeof(pers));

}file.close();cout<<”\n=======================================\n”<<endl;cout<<”\nRecord Found……”;getch();break;

case 3: clrscr();cout<<”MADE BY SAMYAK SAU”;cout<<”\n\nTELEPHONE DIRECTORY :”<<endl;cout<<”\n***************************************”<<endl;cout<<”\nEnter the phone no. to be searched: ”;cin>>phno;file.open(“phone.dat”,ios::in);file.seekg(0,ios::beg);file.read((char*)&pers,sizeof(pers));while(!file.eof())

{if(pers.off_phone==phno||pers.res_phone==phno)

{count++;show_data();getch();break;

}file.read((char*)&pers,sizeof(pers));

}case 4: clrscr();

break;}

}while(ch!=4);}

//FUNCTION TO GENERATE REPORTS

void reports(){

fstream infile;int ch;do

{clrscr();cout<<”MADE BY SAMYAK SAU”;cout<<”\n\nTELEPHONE DIRECTORY :”<<endl;cout<<”\n***************************************”<<endl;cout<<”\nREPORT MENU:\n “;cout<<”\n=======================================\n”<<endl;cout<<”\n1. List of names, Residence and Office Phone no: “;cout<<”\n2. Exit: “;cout<<”\n=======================================\n”<<endl;cout<<”\nEnter your choice: “;cin>>ch;switch(ch)

{

Page 14: computer investigatory report on "Telephone Management"

case 1: clrscr();cout<<”MADE BY SAMYAK SAU”;cout<<”\n\nTELEPHONE DIRECTORY :”<<endl;cout<<”\n***************************************”<<endl;cout<<”\nName, Residential Phone and Office Phone “;infile.open(“phone.dat”, ios::in);infile.seekg(0,ios::beg);infile.read((char*)&pers,sizeof(pers));cout<<endl;while(!infile.eof())

{cout<<endl<<pers.person_name<<endl;cout<<pers.res_phone<<endl;cout<<pers.off_phone;cout<<endl;infile.read((char*)&pers,sizeof(pers));infile.close();cout<<”\n=======================================\n”<<endl;cout<<”\nPress any key to continue….”;getch();

}break;

case 2: clrscr();break;}

}while(ch!=2);

}

Computer Science

with C++

Sumita Arora

Dhanpat Rai & Co.

Page 15: computer investigatory report on "Telephone Management"

Computer Science

Luxmi Publications