09-04-2012, 01:32 PM
PHONEBOOK
PHONEBOOK.doc (Size: 998 KB / Downloads: 34)
ACKNOWLEDGEMENT
This project report has been made possible through the direct and indirect cooperation of various persons, whom I wish to express my appreciation and gratitude.
First and foremost, my intellectual debt is to respect Mr. Satwant Singh who provided me the opportunity to undertake this project.
I am grateful to Lect. Mr. Matish Garg, Department of computer Science, S.B. Institute Of Engineering &Technology Kaithal for his guidance, constant encouragement and sincere support for this project work.
It is my proud privilege to express my profound gratitude to Director(SBIET), Pundri Kaithal and the entire faculty of SBIET KAITHAL and teachers of the department for providing me with the opportunity to avail the excellent facilities and infrastructure. The knowledge and values inculcated have proved to be of immense help at the very start of my career.
I am also very much thankful to teachers of my institute for their support and guidance; without which this project could not have been made possible, and the last but not the least, I am thankful to all the staff in SLR InfoTech Pvt. Ltd. Chandigarh.
I also take this opportunity to express my deed gratitude to my loving parents and friends who were a constant source of motivation and for their never ending support and encouragement during this project.
INTRODUCTION ABOUT C++
C++ is expanded version of c. It was developed by Bjarne Stroustrop. It is an Object-Oriented language. It is the new way of approaching the job of programming. In C language when project exceeds a certain limit then it is very difficult to grasp as totally. So with the development of C, all these problems are solved very easily.
Stroustrup began work on C with Classes in 1979. The idea of creating a new language originated from Stroustrup's experience in programming for his Ph.D. thesis
In 1983, the name of the language was changed from C with Classes to C++. New features that were added to the language included virtual functions, function name and operator overloading, references, constants, user-controlled free-store memory control, improved type checking, and a new comment style (//)
The name "C++"
This name is credited to Rick Mascitti (mid-1983) and was first used in December 1983. Earlier, during the research period, the developing language had been referred to as "new C", then "C with Classes".
According to Stroustrup: "the name signifies the evolutionary nature of the changes from C".
Old problemsTraditionally, C++ compilers have had a range of problems. The C++ standard does not cover implementation of name decoration, exception handling, and other implementation-specific features, making object code produced by different compilers incompatible; there are, however, 3rd-party standards for particular machines or operating systems which attempt to standardize compilers on those platforms (for example C++ ABI[2]), and now many compilers have adopted a secondary standard for these items.
Future development
C++ continues to evolve to meet future requirements.
Philosophy
Bjarne Stroustrup describes some rules that he uses for the design of C++.
C++ is designed to be a statically typed, general-purpose language that is as efficient and portable as C
C++ is designed to directly and comprehensively support multiple programming styles (procedural programming, data abstraction, object-oriented programming, and generic programming)
C++ is designed to give the programmer choice, even if this makes it possible for the programmer to choose incorrectly.
C++ is designed to be as compatible with C as possible, therefore providing a smooth transition from C.
C++ avoids features that are platform specific or not general purpose.
C++ does not incur overhead for features that are not used.
C++ is designed to function without a sophisticated programming environment.
ADVANTAGES OF C++ OVER C
Operators and operator overloading
C++ provides more than 30 OPERATORS, covering basic arithmetic, bit manipulation, indirection, comparisons, logic and more. Almost all operators can be OVERLOADED for user-defined types, with a few notable exceptions such as member access (. and.*). The rich set of over loadable operators is central to using C++ as a DOMAIN SPECIFIC LANGUAGE.
The over loadable operators are also an essential part of many advanced C++ programming techniques, such as SMART POINTER.
Overloading an operator does not change the precedence of calculations involving the operator, nor does it change the number of operands that the operator uses (any operand may however be ignored).
Templates
Templates are different from macros: while both of these compile-time language features can be used to produce conditional compilation, templates are not restricted to lexical substitution. Templates have an awareness of the semantics and type system of their companion language as well as all compile-time type definitions and can perform high-level operations including programmatic flow control based on evaluation of strictly type-checked parameters. Macros are capable of conditional control over compilation based on predetermined criteria but cannot instantiate new types recourse or perform type evaluation and in effect are limited to pre-compilation text-substitution and text-inclusion/exclusion. In other words, macros can control compilation flow based on pre-defined symbols but cannot, unlike templates, independently instantiate new symbols.
Objects
C++ introduces some object oriented (OO) features to C. It offers classes, which provide the four features commonly present in OO (and some non-OO) languages: abstraction, encapsulation, inheritance and polymorphism. Objects are instances of classes created at runtime. Think of the class as a template from which many different individual objects may be generated as a program runs.
Encapsulation
Encapsulation is the grouping together of data and functionality. C++ implements encapsulation by allowing all members of a class to be declared as either public, private, or protected. A public member of the class is accessible to any function. A private member is accessible only to functions that are members of that class and to functions and classes explicitly granted access permission by the class ("friends"). A protected member is accessible to members of classes that inherit from the class in addition to the class itself and any friends.
Inheritance
Inheritance allows one data type to acquire properties of other data types. Inheritance from a base class may be declared as public, protected, or private. This access specifier determines whether unrelated and derived classes can access the inherited public and protected members of the base class. Only public inheritance corresponds to what is usually meant by "inheritance". The other two forms are much less frequently used. If the access specifier is omitted, inheritance is assumed to be private for a class base and public for a struct base. Base classes may be declared as virtual; this is called virtual inheritance. Virtual inheritance ensures that only one instance of a base class exists in the inheritance graph, avoiding some of the ambiguity problems of multiple inheritance.
Polymorphism
Polymorphism enables one common interface for many implementations, and for objects to act differently under different circumstances.
C++ supports several kinds of static and dynamic polymorphism. Compile-time polymorphism does not allow for certain run-time decisions, while run-time polymorphism typically incurs a performance penalty.
#include<iostream.h>
#include<stdio.h>
#include<conio.h>
#include<fstream.h>
#include<string.h>
#include<stdlib.h>
class phonebook
{
public:
char name[20];
char phno[13];
char phno1[13];
char phno2[13];
phonebook()
{
phno1[0]='\0';
phno2[0]='\0';
}
void disp()
{
cout<<endl<<"name:-"<<endl;
puts(name);
cout<<"Phone number 1:-"<<'\t'<<"Phone number 2:-"<<'\t'<<"Phone number 3:-"<<endl;
cout<<phno<<'\t'<<'\t'<<phno1<<'\t'<<'\t'<<phno2<<endl;
}
};
void main()
{
char n;
gotoxy(25,10);
cout<<"WELCOME TO PRINCE's PHONEBOOK..";
gotoxy(22,11);
cout<<"YOUR COMPLETE DATABASE OF CONTACTS !!!";
gotoxy(0,25);
cout<<"Press any key to continue";
n=getch();
clrscr();
ofstream file;
file.open("phonebook.txt",ios::app);
file.close();
options:
phonebook phbook;
int y,z,k,j=1,m=0,s=1;
long i,l,x;
char a[10],b[10],ed[20],d[20],c,ph,phh;
cout<<endl<<"Choose your option from the list"<<endl;
cout<<"1:-View all contacts"<<endl
<<"2:-Search contact"<<endl
<<"3:-Add contact"<<endl
<<"4:-Edit contact"<<endl
<<"5:-Delete contact"<<endl
<<"6:-Delete all contacts"<<endl
<<"7:-Quit"<<endl;
fflush(stdin);
cin>>y;
switch(y)
{
case 1:
{
ifstream file;
file.open("phonebook.txt",ios::binary);
file.seekg(0,ios::end);
i=file.tellg();
if(i==0)
{
cout<<"Phonebook is empty"<<endl<<endl;
file.close();
goto options;
}
else
{
int arr[20]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
int y,j,k,temp;
char a[20],b[20];
ifstream file3;
ofstream f;
f.open("xyz.txt",ios::app);
file3.open("phonebook.txt",ios::binary);
file3.seekg(0,ios::end);
i=file3.tellg();
k=i/59;
for (y = (k - 1); y >= 0; y--)
{
file3.seekg(arr[0]*59,ios::beg);
file3.get(&a[0],20,'\0');
for (j = 1; j <= y
{
file3.seekg(59*arr[j],ios::beg);
file3.get(&b[0],20,'\0');
if (strcmpi(a,b)>0)
{
temp = arr[j-1];
arr[j-1] = arr[j];
arr[j] = temp;
}
file3.seekg(59*arr[j],ios::beg);
file3.get(&a[0],20,'\0');
j=j+1;
}
}
for(y=0;y<k;y++)
{
file3.seekg(59*arr[y],ios::beg);
file3.read((char*)&phbook,sizeof(phbook));
f.write((char*)&phbook,sizeof(phbook));
}
f.close();
file3.close();
remove("phonebook.txt");
rename("xyz.txt","phonebook.txt");
ifstream file;
file.open("phonebook.txt",ios::binary);
file.seekg(0,ios::beg);
while(m!=i)
{
file.read((char*)&phbook,sizeof(phbook));
phbook.disp();
m+=59;
}
}
file.close();
goto options;
}
case 2:
{
cout<<"1:-Search by first name"<<endl
<<"2:-Search by last name"<<endl
<<"3:-Search by full name"<<endl
<<"4:-General(Refined) Search"<<endl;
fflush(stdin);
cin>>z;
switch(z)
{
case 1:
{
ifstream file;
file.open("phonebook.txt",ios::binary);
cout<<"Type the first name"<<endl;
fflush(stdin);
cin>>a;
while(file.eof()!=1)
{
i=file.tellg();
file.get(&b[0],10,' ');
k=strcmpi(a,b);
if(k==0)
{
file.seekg(i,ios::beg);
file.read((char*)&phbook,sizeof(phbook));
phbook.disp();
}
file.seekg((59*j),ios::beg);
j++;
s=s*k;
}
if(s!=0)
{
cout<<"match not found!!"<<endl<<endl;
file.close();
goto options;
}
else
{
file.close();
goto options;
}
}
case 2:
{
ifstream file;
file.open("phonebook.txt",ios::binary);
cout<<"Type the last name"<<endl;
fflush(stdin);
cin>>a;
file.seekg(0,ios::beg);
while(file.eof()!=1)
{
i=file.tellg();
file.get(&b[0],10,' ');
file.seekg(1,ios::cur);
file.get(&d[0],10,'\0');
k=strcmpi(a,d);
if(k==0)
{
file.seekg(i,ios::beg);
file.read((char*)&phbook,sizeof(phbook));
phbook.disp();
}
file.seekg((59*j),ios::beg);
j++;
s=s*k;
}
if(s!=0)
{
cout<<"match not found!!"<<endl<<endl;
file.close();
goto options;
}
else
{
file.close();
goto options;
}
}
case 3:
{
ifstream file;
file.open("phonebook.txt",ios::binary);
cout<<"Type the full name"<<endl;
fflush(stdin);
gets(a);
strcpy(ed,a);
file.seekg(0,ios::beg);
while(file.eof()!=1)
{
i=file.tellg();
file.get(&b[0],20,'\0');
strcpy(d,b);
k=strcmpi(ed,d);
if(k==0)
{
file.seekg(i,ios::beg);
file.read((char*)&phbook,sizeof(phbook));
phbook.disp();
goto options;
}
file.seekg((59*j),ios::beg);
j++;
s=s*k;
}
if(s!=0)
{
cout<<"match not found!!"<<endl<<endl;
file.close();
goto options;
}
else
{
file.close();
goto options;
}
}
case 4:
{
ifstream file;
file.open("phonebook.txt",ios::binary);
file.seekg(0,ios::end);
x=file.tellg();
file.seekg(0,ios::beg);
int g=0,h=1,e=1,p;
char ar[20]="",ch;
clrscr();
flushall();
while(1)
{
clrscr();
cout<<ar;
ch = getch();
flushall();
if(ch==13)
{
ar[g] = '\0';
break;
}
gotoxy(e,h);
printf("%c",ch);
e++;
ar[g] = ch;
g++;
ar[g]= '\0';
p=strlen(ar);
file.clear();
file.seekg(0,ios::beg);
int w=0;
while(w!=x)
{
char temp[20];
file.read((char*)&phbook,sizeof(phbook));
strcpy(temp,phbook.name);
temp[p] = '\0';
if(stricmp(temp,ar)==0)
{
phbook.disp();
}
m++;
w+=59;
}
getch();
flushall();
}
getch();
clrscr();
goto options;
}
}
case 3:
{
ofstream file1;
file1.open("phonebook.txt",ios::app);
file1.close();
ifstream file;
file.open("phonebook.txt",ios::binary);
cout<<"Type the name"<<endl;
fflush(stdin);
gets(a);
strcpy(d,a);
file.seekg(0,ios::beg);
while(file.eof()!=1)
{
file.get(&b[0],20);
k=strcmpi(d,b);
if(k==0)
{
again:
cout<<"This contact already exists"<<endl
<<"Do you want to replace it?(y/n)"<<endl;
fflush(stdin);
c=getche();
if(c=='y')
{
goto contd;
}
if(c=='n')
{
goto options;
}
else
{
cout<<"Not a valid reply"<<endl<<endl;
goto again;
}
}
file.seekg((59*j),ios::beg);
j++;
}
if(k!=0)
goto contd;
contd:
strcpy(phbook.name,d);
cout<<"enter the phone number"<<endl;
cin>>phbook.phno;
cout<<"Do you want to enter more phone numbers?(y/n)"<<endl;
flushall();
ph=getch();
if(ph=='y')
{
cout<<"Enter second phone number"<<endl;
cin>>phbook.phno1;
cout<<"Do you want to enter another phone number?(y/n)"<<endl;
flushall();
phh=getch();
if(phh=='y')
{
cout<<"Enter third phone number"<<endl;
cin>>phbook.phno2;
}
if(phh=='n')
goto finish;
}
if(ph=='n')
goto finish;
finish:
file.close();
ofstream file2;
file2.open("phonebook.txt",ios::app);
file2.write((char*)&phbook,sizeof(phbook));
file2.close();
phonebook phbook;
goto options;
}
case 4:
{
m=0;
ifstream file;
file.open("phonebook.txt",ios::binary);
int ad[50],p;
cout<<"Enter the name"<<endl;
flushall();
gets(ed);
p=strlen(ed);
l=0;
file.seekg(0,ios::end);
x=file.tellg();
file.seekg(0,ios::beg);
while(m!=x)
{
char temp[20];
i=file.tellg();
file.read((char*)&phbook,sizeof(phbook));
strcpy(temp,phbook.name);
temp[p] = '\0';
if(stricmp(temp,ed)==0)
{
cout<<endl<<"Contact number"<<" "<<(l+1)<<endl;
phbook.disp();
l++;
ad[l-1]=i;
}
m+=59;
}
if(l>1)
{
m=0;
phonebook phbook;
file.seekg(0,ios::beg);
cout<<"Select the name you want to edit by typing the corresponding number"<<endl;
cin>>y;
while(m!=x)
{
if(m!=ad[y-1])
{
ofstream cpy("xyz.txt",ios::app);
file.read((char*)&phbook,sizeof(phbook));
cpy.write((char*)&phbook,sizeof(phbook));
cpy.close();
}
if(m==ad[y-1])
{
cout<<"Type the new name"<<endl;
gets(ed);
cout<<"Type the new phone number"<<endl;
strcpy(phbook.name,ed);
cin>>phbook.phno;
cout<<"Do you want to enter more phone numbers?(y/n)"<<endl;
flushall();
ph=getch();
if(ph=='y')
{
cout<<"Enter second phone number"<<endl;
cin>>phbook.phno1;
cout<<"Do you want to enter another phone number?(y/n)"<<endl;
flushall();
phh=getch();
if(phh=='y')
{
cout<<"Enter third phone number"<<endl;
cin>>phbook.phno2;
}
if(phh=='n')
goto done;
}
if(ph=='n')
goto done;
done:
ofstream cpy("xyz.txt",ios::app);
cpy.write((char*)&phbook,sizeof(phbook));
cpy.close();
phonebook phbook;
file.seekg(59,ios::cur);
}
m+=59;
}
}
if(l==1)
{
phonebook phbook;
file.seekg(0,ios::end);
x=file.tellg();
file.seekg(0,ios::beg);
m=0;
while(m!=x)
{
if(m!=ad[0])
{
ofstream cpy("xyz.txt",ios::app);
file.read((char*)&phbook,sizeof(phbook));
cpy.write((char*)&phbook,sizeof(phbook));
cpy.close();
}
else
{
file.seekg(59,ios::cur);
}
m+=59;
}
cout<<"Type the new name"<<endl;
flushall();
gets(ed);
cout<<"Type the new phone number"<<endl;
strcpy(phbook.name,ed);
cin>>phbook.phno;
cout<<"Do you want to enter more phone numbers?(y/n)"<<endl;
flushall();
ph=getch();
if(ph=='y')
{
cout<<"Enter second phone number"<<endl;
cin>>phbook.phno1;
cout<<"Do you want to enter another phone number?(y/n)"<<endl;
flushall();
phh=getch();
if(phh=='y')
{
cout<<"Enter third phone number"<<endl;
cin>>phbook.phno2;
}
if(phh=='n')
goto look;
}
if(ph=='n')
goto look;
look:
ofstream cpy("xyz.txt",ios::app);
cpy.write((char*)&phbook,sizeof(phbook));
cpy.close();
phonebook phbook1;
}
if(l==0)
{
cout<<"This contact does not exist"<<endl;
goto options;
}
remove("phonebook.txt");
rename("xyz.txt","phonebook.txt");
ifstream file2;
file2.open("phonebook.txt",ios::binary);
goto options;
}
case 5:
{
m=0;
ifstream file;
file.open("phonebook.txt",ios::binary);
int ad[50],p;
cout<<"Enter the name"<<endl;
flushall();
gets(ed);
p=strlen(ed);
l=0;
file.seekg(0,ios::end);
x=file.tellg();
file.seekg(0,ios::beg);
while(m!=x)
{
char temp[20];
i=file.tellg();
file.read((char*)&phbook,sizeof(phbook));
strcpy(temp,phbook.name);
temp[p] = '\0';
if(stricmp(temp,ed)==0)
{
cout<<endl<<"Contact number"<<" "<<(l+1)<<endl;
phbook.disp();
l++;
ad[l-1]=i;
}
m+=59;
}
if(l>1)
{
m=0;
file.seekg(0,ios::beg);
cout<<"Select the name you want to delete by typing the corresponding number"<<endl;
cin>>y;
cout<<"Are you sure you want to delete this contact?(y/n)"<<endl;
flushall();
c=getche();
if(c=='y')
{
while(m!=x)
{
if(m!=ad[y-1])
{
ofstream cpy("xyz.txt",ios::app);
file.read((char*)&phbook,sizeof(phbook));
cpy.write((char*)&phbook,sizeof(phbook));
cpy.close();
}
else
{
file.read((char*)&phbook,sizeof(phbook));
}
m+=59;
}
}
else
goto options;
}
if(l==1)
{
cout<<"Are you sure you want delete this contact?(y/n)"<<endl;
flushall();
c=getche();
if(c=='y')
{
file.seekg(0,ios::end);
x=file.tellg();
file.seekg(0,ios::beg);
m=0;
while(m!=x)
{
if(m!=ad[0])
{
ofstream cpy("xyz.txt",ios::app);
file.read((char*)&phbook,sizeof(phbook));
cpy.write((char*)&phbook,sizeof(phbook));
cpy.close();
}
else
{
file.seekg(59,ios::cur);
}
m+=59;
}
}
else
goto options;
}
if(l==0)
{
cout<<"This contact does not exist"<<endl<<endl;
goto options;
}
file.close();
remove("phonebook.txt");
rename("xyz.txt","phonebook.txt");
ifstream file1;
file1.open("phonebook.txt",ios::binary);
goto options;
}
case 6:
{
ifstream file;
file.open("phonebook.txt",ios::binary);
cout<<"Are you sure you want to delete all contacts?(y/n)"<<endl;
fflush(stdin);
c=getche();
if(c=='y')
{
remove("phonebook.txt");
ofstream file;
file.open("phonebook.txt",ios::app);
file.close();
goto options;
}
if(c=='n')
goto options;
else
cout<<"You have entered an invalid option"<<endl<<endl;
goto options;
}
case 7:
{
exit(0);
}
default:
{
cout<<"You have entered an invalid choice"<<endl;
goto options;
}
}
}
}
#include<iostream.h>
#include<stdio.h>
#include<conio.h>
#include<fstream.h>
#include<string.h>
#include<stdlib.h>
class phonebook
{
public:
char name[20];
char phno[13];
char phno1[13];
char phno2[13];
phonebook()
{
phno1[0]='\0';
phno2[0]='\0';
}
void disp()
{
cout<<endl<<"name:-"<<endl;
puts(name);
cout<<"Phone number 1:-"<<'\t'<<"Phone number 2:-"<<'\t'<<"Phone number 3:-"<<endl;
cout<<phno<<'\t'<<'\t'<<phno1<<'\t'<<'\t'<<phno2<<endl;
}
};
void main()
{
char n;
gotoxy(25,10);
cout<<"WELCOME TO PRINCE's PHONEBOOK..";
gotoxy(22,11);
cout<<"YOUR COMPLETE DATABASE OF CONTACTS !!!";
gotoxy(0,25);
cout<<"Press any key to continue";
n=getch();
clrscr();
ofstream file;
file.open("phonebook.txt",ios::app);
file.close();
options:
phonebook phbook;
int y,z,k,j=1,m=0,s=1;
long i,l,x;
char a[10],b[10],ed[20],d[20],c,ph,phh;
cout<<endl<<"Choose your option from the list"<<endl;
cout<<"1:-View all contacts"<<endl
<<"2:-Search contact"<<endl
<<"3:-Add contact"<<endl
<<"4:-Edit contact"<<endl
<<"5:-Delete contact"<<endl
<<"6:-Delete all contacts"<<endl
<<"7:-Quit"<<endl;
fflush(stdin);
cin>>y;
switch(y)
{
case 1:
{
ifstream file;
file.open("phonebook.txt",ios::binary);
file.seekg(0,ios::end);
i=file.tellg();
if(i==0)
{
cout<<"Phonebook is empty"<<endl<<endl;
file.close();
goto options;
}
else
{
int arr[20]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
int y,j,k,temp;
char a[20],b[20];
ifstream file3;
ofstream f;
f.open("xyz.txt",ios::app);
file3.open("phonebook.txt",ios::binary);
file3.seekg(0,ios::end);
i=file3.tellg();
k=i/59;
for (y = (k - 1); y >= 0; y--)
{
file3.seekg(arr[0]*59,ios::beg);
file3.get(&a[0],20,'\0');
for (j = 1; j <= y
{
file3.seekg(59*arr[j],ios::beg);
file3.get(&b[0],20,'\0');
if (strcmpi(a,b)>0)
{
temp = arr[j-1];
arr[j-1] = arr[j];
arr[j] = temp;
}
file3.seekg(59*arr[j],ios::beg);
file3.get(&a[0],20,'\0');
j=j+1;
}
}
for(y=0;y<k;y++)
{
file3.seekg(59*arr[y],ios::beg);
file3.read((char*)&phbook,sizeof(phbook));
f.write((char*)&phbook,sizeof(phbook));
}
f.close();
file3.close();
remove("phonebook.txt");
rename("xyz.txt","phonebook.txt");
ifstream file;
file.open("phonebook.txt",ios::binary);
file.seekg(0,ios::beg);
while(m!=i)
{
file.read((char*)&phbook,sizeof(phbook));
phbook.disp();
m+=59;
}
}
file.close();
goto options;
}
case 2:
{
cout<<"1:-Search by first name"<<endl
<<"2:-Search by last name"<<endl
<<"3:-Search by full name"<<endl
<<"4:-General(Refined) Search"<<endl;
fflush(stdin);
cin>>z;
switch(z)
{
case 1:
{
ifstream file;
file.open("phonebook.txt",ios::binary);
cout<<"Type the first name"<<endl;
fflush(stdin);
cin>>a;
while(file.eof()!=1)
{
i=file.tellg();
file.get(&b[0],10,' ');
k=strcmpi(a,b);
if(k==0)
{
file.seekg(i,ios::beg);
file.read((char*)&phbook,sizeof(phbook));
phbook.disp();
}
file.seekg((59*j),ios::beg);
j++;
s=s*k;
}
if(s!=0)
{
cout<<"match not found!!"<<endl<<endl;
file.close();
goto options;
}
else
{
file.close();
goto options;
}
}
case 2:
{
ifstream file;
file.open("phonebook.txt",ios::binary);
cout<<"Type the last name"<<endl;
fflush(stdin);
cin>>a;
file.seekg(0,ios::beg);
while(file.eof()!=1)
{
i=file.tellg();
file.get(&b[0],10,' ');
file.seekg(1,ios::cur);
file.get(&d[0],10,'\0');
k=strcmpi(a,d);
if(k==0)
{
file.seekg(i,ios::beg);
file.read((char*)&phbook,sizeof(phbook));
phbook.disp();
}
file.seekg((59*j),ios::beg);
j++;
s=s*k;
}
if(s!=0)
{
cout<<"match not found!!"<<endl<<endl;
file.close();
goto options;
}
else
{
file.close();
goto options;
}
}
case 3:
{
ifstream file;
file.open("phonebook.txt",ios::binary);
cout<<"Type the full name"<<endl;
fflush(stdin);
gets(a);
strcpy(ed,a);
file.seekg(0,ios::beg);
while(file.eof()!=1)
{
i=file.tellg();
file.get(&b[0],20,'\0');
strcpy(d,b);
k=strcmpi(ed,d);
if(k==0)
{
file.seekg(i,ios::beg);
file.read((char*)&phbook,sizeof(phbook));
phbook.disp();
goto options;
}
file.seekg((59*j),ios::beg);
j++;
s=s*k;
}
if(s!=0)
{
cout<<"match not found!!"<<endl<<endl;
file.close();
goto options;
}
else
{
file.close();
goto options;