In: Computer Science
In C create a program that stores contact info. The program must have the following features:
The program must have the following structure:
Extra credit:
#ifndef ContactList_H
#define ContactList_H
#define MAX 100
typedef struct
{
int day;
int month;
int year;
}DateOfBirth;
typedef struct
{
char *FirstName;
char *PhoneNumber;
DateOfBirth Birthday;
}ContactList;
// Function to accept contact details
void acceptContact(ContactList [], int *);
// Function to search a contact information based on first
name
// If found returns the found index position otherwise returns
-`
int findFirstName(ContactList [], int*, char []);
// Function to search a contact information based on phone
number
// If found returns the found index position otherwise returns
-`
int findPhoneNumber(ContactList [], int*, char []);
// Function to search a contact information based on date of
birth
// If found returns the found index position otherwise returns
-`
int findBirthday(ContactList [], int*, int, int, int);
// Function to delete a contact information based on first
name
void deleteFirstName(ContactList [], int *, char []);
// Function to delete a contact information based on phone
number
void deletePhoneNumber(ContactList [], int *, char []);
// Function to delete a contact information based on date of
birth
void deleteBirthday(ContactList [], int *, int, int, int);
// Function to display all contact information
void printContactList(ContactList [], int);
// Function to return number of contact information
void showNumberOfContacts(int);
// Function to read the file contents and stores contact
information
void readFile(ContactList [], int *);
// Function to write contact information to the file
void writeFile(ContactList [], int);
// Function to display menu, accept user choice and returns
it
int menu();
#endif
-----------------------------------------------------------------------------------
#include "contactList.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Function to accept contact details
void acceptContact(ContactList cl[], int *len)
{
// Dynamically allocates memory for first name and phone
number
cl[*len].FirstName = (char *) malloc(sizeof(char) * 20);
cl[*len].PhoneNumber = (char *) malloc(sizeof(char) * 20);
// Accepts first name from the user
printf("\n Enter First Name: ");
scanf("%s", cl[*len].FirstName);
// Accepts phone number from the user
printf("\n Enter Phone Number: ");
scanf("%s", cl[*len].PhoneNumber);
// Accepts birth date from the user
printf("\n Enter Date Of Birth: ");
// Accepts month from the user
printf("\n Enter Month: ");
scanf("%d", &cl[*len].Birthday.month);
// Accepts day from the user
printf("\n Enter Day: ");
scanf("%d", &cl[*len].Birthday.day);
// Accepts year from the user
printf("\n Enter Year: ");
scanf("%d", &cl[*len].Birthday.year);
// Increase the record counter by one
*len = *len + 1;
}// End of function
// Function to search a contact information based on first
name
// If found returns the found index position otherwise returns
-`
int findFirstName(ContactList cl[], int *len, char name[])
{
// Loop variable
int c;
// Loops till number of records
for(c = 0; c < *len; c++)
{
// Checks if parameter name is equals to current record name
if(strcmp(name, cl[c].FirstName) == 0)
// Returns the found index position
return c;
}// End of for loop
// Returns -1 for not found
return -1;
}// End of function
// Function to search a contact information based on phone
number
// If found returns the found index position otherwise returns
-`
int findPhoneNumber(ContactList cl[], int *len, char phone[])
{
// Loop variable
int c;
// Loops till number of records
for(c = 0; c < *len; c++)
{
// Checks if parameter phone number is equals to current record
phone number
if(strcmp(phone, cl[c].PhoneNumber) == 0)
// Returns the found index position
return c;
}// End of for loop
// Returns -1 for not found
return -1;
}// End of function
// Function to search a contact information based on date of
birth
// If found returns the found index position otherwise returns
-`
int findBirthday(ContactList cl[], int *len, int month, int day,
int year)
{
// Loop variable
int c;
// Loops till number of records
for(c = 0; c < *len; c++)
{
// Checks if parameter day, month and year is equals to current
record day, month and year
if(month == cl[c].Birthday.month && day ==
cl[c].Birthday.day && year == cl[c].Birthday.year)
// Returns the found index position
return c;
}// End of for loop
// Returns -1 for not found
return -1;
}// End of function
// Function to delete a contact information based on first
name
void deleteFirstName(ContactList cl[], int *len, char name[])
{
// Loop variable
int c;
// Calls the function to search name
int pos = findFirstName(cl, len, name);
// Checks if found position is not -1 record found
if(pos != -1)
{
// Loops from found index position to end of records
for(c = pos; c < *len; c++)
// Shift each record one position left
cl[c] = cl[c + 1];
// Decrease the record counter by one
*len = *len - 1;
// Displays success message
printf("\n Contact name %s deleted success fully.", name);
}// End of if condition
// Otherwise displays error message
else
printf("\n Unable to delete the name %s.", name);
}// End of function
// Function to delete a contact information based on phone
number
void deletePhoneNumber(ContactList cl[], int *len, char
phone[])
{
// Loop variable
int c;
// Calls the function to search phone
int pos = findPhoneNumber(cl, len, phone);
// Checks if found position is not -1 record found
if(pos != -1)
{
// Loops from found index position to end of records
for(c = pos; c < *len; c++)
// Shift each record one position left
cl[c] = cl[c + 1];
// Decrease the record counter by one
*len = *len - 1;
// Displays success message
printf("\n Contact phone number %s deleted success fully.",
phone);
}// End of if condition
// Otherwise displays error message
else
printf("\n Unable to delete the phone number %s.", phone);
}// End of function
// Function to delete a contact information based on date of
birth
void deleteBirthday(ContactList cl[], int *len, int month, int day,
int year)
{
// Loop variable
int c;
// Calls the function to search birthday
int pos = findBirthday(cl, len, month, day, year);
// Checks if found position is not -1 record found
if(pos != -1)
{
// Loops from found index position to end of records
for(c = pos; c < *len; c++)
// Shift each record one position left
cl[c] = cl[c + 1];
// Decrease the record counter by one
*len = *len - 1;
// Displays success message
printf("\n Contact Birthday %d-%d-%d deleted success fully.",
month, day, year);
}// End of if condition
// Otherwise displays error message
else
printf("\n Unable to delete the birthday %d-%d-%d.", month, day,
year);
}// End of function
// Function to display all contact information
void printContactList(ContactList cl[], int len)
{
// Loop variable
int c;
printf("\n *********************** Contact Information *********************** ");
// Loops till number of records
for(c = 0; c < len; c++)
{
// Displays each record information
printf("\n\n First Name: %s \n Phone Number: %s", cl[c].FirstName,
cl[c].PhoneNumber);
printf("\n Birth Day: %d-%d-%d", cl[c].Birthday.month,
cl[c].Birthday.day, cl[c].Birthday.year);
}// End of for loop
}// End of function
// Function to return number of contact information
void showNumberOfContacts(int len)
{
printf("\n Number of contact records %d", len);
}// End of function
// Function to read the file contents and stores contact
information
void readFile(ContactList cl[], int *len)
{
// Creates a file pointer to open the file ContactInfo.txt in read
mode
FILE *rFile = fopen("ContactInfo.txt", "r");
// Re opens the file in read mode
// checks if file is unable to open for reading then display error
message
// Stop the program
if (rFile == NULL)
{
printf("Error! opening file for reading.");
exit(1);
}// End of if condition
// Extracts data from file and count
while (!feof(rFile))
{
// Dynamically allocates memory for first name and phone
number
cl[*len].FirstName = (char *) malloc(sizeof(char) * 20);
cl[*len].PhoneNumber = (char *) malloc(sizeof(char) * 20);
// Extracts first name from the file and stores at len index
position
fscanf(rFile, "%s", cl[*len].FirstName);
// Extracts phone number from the file and stores at len index
position
fscanf(rFile, "%s", cl[*len].PhoneNumber);
// Extracts month number from the file and stores at len index
position
fscanf(rFile, "%d", &cl[*len].Birthday.month);
// Extracts day number from the file and stores at len index
position
fscanf(rFile, "%d", &cl[*len].Birthday.day);
// Extracts year number from the file and stores at len index
position
fscanf(rFile, "%d", &cl[*len].Birthday.year);
// Increase the counter by one
*len = *len + 1;
}// End of while loop
printf("\n File Read Successfully Done.");
}// End of function
// Function to write contact information to the file
void writeFile(ContactList cl[], int len)
{
// Loops variable
int c;
// Creates a file pointer to open the file ContactInfo.txt in write
mode
FILE *wFile = fopen("ContactInfo.txt", "w");
// Re opens the file in write mode
// checks if file is unable to open for writing then display error
message
// Stop the program
if (wFile == NULL)
{
printf("Error! opening file for writing.");
exit(1);
}// End of if condition
// Extracts data from file and count
for(c = 0; c < len; c++)
{
if(c == 0)
{
// Writes first name from the file and stores at len index
position
fprintf(wFile, "%s\n", cl[c].FirstName);
// Writes phone number from the file and stores at len index
position
fprintf(wFile, "%s\n", cl[c].PhoneNumber);
// Writes month number from the file and stores at len index
position
fprintf(wFile, "%d\n", cl[c].Birthday.month);
// Writes day number from the file and stores at len index
position
fprintf(wFile, "%d\n", cl[c].Birthday.day);
// Writes year number from the file and stores at len index
position
fprintf(wFile, "%d\n", cl[c].Birthday.year);
}// End of if condition
// Otherwise not the first record
else
{
// Writes first name from the file and stores at len index
position
fprintf(wFile, "\n%s", cl[c].FirstName);
// Writes phone number from the file and stores at len index
position
fprintf(wFile, "\n%s", cl[c].PhoneNumber);
// Writes month number from the file and stores at len index
position
fprintf(wFile, "\n%d", cl[c].Birthday.month);
// Writes day number from the file and stores at len index
position
fprintf(wFile, "\n%d", cl[c].Birthday.day);
// Writes year number from the file and stores at len index
position
fprintf(wFile, "\n%d", cl[c].Birthday.year);
}// End of else
}// End of while loop
printf("\n File Write Successfully Done.");
}// End of function
// Function to display menu, accept user choice and returns
it
int menu()
{
int ch;
printf("\n\n *********************** MENU
***********************");
printf("\n 1) Add Contact Information.");
printf("\n 2) Search Contact Information by First Name.");
printf("\n 3) Search Contact Information by Phone Number.");
printf("\n 4) Search Contact Information by Birthday.");
printf("\n 5) Delete Contact Information by First Name.");
printf("\n 6) Delete Contact Information by Phone Number.");
printf("\n 7) Delete Contact Information by Birthday.");
printf("\n 8) Show Number Of Contact Information.");
printf("\n 9) Show All Contact Information.");
printf("\n 10) Save Contact Information.");
printf("\n 11) Read Contact Information.");
printf("\n 12) Exit.");
printf("\n What is your choice? ");
scanf("%d", &ch);
return ch;
}// End of function
--------------------------------------------------------------------------
#include "ContactList.c"
// main function definition
int main()
{
// Creates an array of objects of class ContactList
ContactList contacts[MAX];
// To store number of records
int len = 0;
// To store position return by the function
int pos;
// To store name entered by the user
char name[20];
// To store phone entered by the user
char phone[20];
// To store the month, day and year entered by the user
int month, day, year;
// Loops till user choice is not 12
do
{
// Calls the function to accept user choice and calls appropriate
function based on user choice
switch(menu())
{
case 1:
// Calls the function to accept contact information from the
user
acceptContact(contacts, &len);
break;
case 2:
// Accepts the name from the user
printf("\n Enter the name to search: ");
scanf("%s", name);
// Calls the function to search name and stores the returns
found index position
pos = findFirstName(contacts, &len, name);
// Checks if found position is not -1 record found
if(pos != -1)
{
// Displays each record information
printf("\n\n First Name: %s \n Phone Number: %s",
contacts[pos].FirstName,
contacts[pos].PhoneNumber);
printf("\n Birth Day: %d-%d-%d",
contacts[pos].Birthday.month,
contacts[pos].Birthday.day, contacts[pos].Birthday.year);
}// End of if condition
// Otherwise record not found display error message
else
printf("\n No record found on name: %s", name);
break;
case 3:
// Accepts the phone from the user
printf("\n Enter the phone number to search: ");
scanf("%s", phone);
// Calls the function to search phone number and stores the returns
found index position
pos = findPhoneNumber(contacts, &len, phone);
// Checks if found position is not -1 record found
if(pos != -1)
{
// Displays each record information
printf("\n\n First Name: %s \n Phone Number: %s",
contacts[pos].FirstName,
contacts[pos].PhoneNumber);
printf("\n Birth Day: %d-%d-%d",
contacts[pos].Birthday.month,
contacts[pos].Birthday.day, contacts[pos].Birthday.year);
}// End of if condition
// Otherwise record not found display error message
else
printf("\n No record found on contact number: %s", phone);
break;
case 4:
// Accepts the birthday from the user
printf("\n Enter the Birthday to search: ");
printf("\n Enter the month: ");
scanf("%d", &month);
printf("\n Enter the day: ");
scanf("%d", &day);
printf("\n Enter the year: ");
scanf("%d", &year);
// Calls the function to search birthday and stores the returns
found index position
pos = findBirthday(contacts, &len, month, day, year);
// Checks if found position is not -1 record found
if(pos != -1)
{
// Displays each record information
printf("\n\n First Name: %s \n Phone Number: %s",
contacts[pos].FirstName,
contacts[pos].PhoneNumber);
printf("\n Birth Day: %d-%d-%d",
contacts[pos].Birthday.month,
contacts[pos].Birthday.day, contacts[pos].Birthday.year);
}// End of if condition
// Otherwise record not found display error message
else
printf("\n No record found on Birthday: %d-%d-%d", month, day,
year);
break;
case 5:
// Accepts the name from the user
printf("\n Enter the name to search: ");
scanf("%s", name);
// Calls the function to delete record
deleteFirstName(contacts, &len, name);
break;
case 6:
// Accepts the phone number from the user
printf("\n Enter the phone number to search: ");
scanf("%s", phone);
// Calls the function to delete record
deletePhoneNumber(contacts, &len, phone);
break;
case 7:
// Accepts the birthday from the user
printf("\n Enter the Birthday to delete: ");
printf("\n Enter the month: ");
scanf("%d", &month);
printf("\n Enter the day: ");
scanf("%d", &day);
printf("\n Enter the year: ");
scanf("%d", &year);
// Calls the function to delete record
deleteBirthday(contacts, &len, month, day, year);
break;
case 8:
showNumberOfContacts(len);
break;
case 9:
printContactList(contacts, len);
break;
case 10:
writeFile(contacts, len);
break;
case 11:
readFile(contacts, &len);
break;
case 12:
exit(0);
default:
printf("\n Invalid Choice........");
}// End of switch - case
}while(1);// End of do - while loop
return 0;
}// End of main function
Sample Output:
*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 11
File Read Successfully Done.
*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 9
*********************** Contact Information ***********************
First Name: Pyari
Phone Number: 9040114545
Birth Day: 8-18-2001
First Name: Mohan
Phone Number: 8942214333
Birth Day: 5-14-2011
First Name: Amit
Phone Number: 7822456789
Birth Day: 9-19-2014
First Name: Suresh
Phone Number: 9822654112
Birth Day: 6-12-2015
First Name: Binod
Phone Number: 8845655987
Birth Day: 9-25-2019
First Name: Sunita
Phone Number: 7788456523
Birth Day: 1-22-1998
*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 1
Enter First Name: Rahul
Enter Phone Number: 1122334455
Enter Date Of Birth:
Enter Month: 1
Enter Day: 1
Enter Year: 2000
*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 9
*********************** Contact Information ***********************
First Name: Pyari
Phone Number: 9040114545
Birth Day: 8-18-2001
First Name: Mohan
Phone Number: 8942214333
Birth Day: 5-14-2011
First Name: Amit
Phone Number: 7822456789
Birth Day: 9-19-2014
First Name: Suresh
Phone Number: 9822654112
Birth Day: 6-12-2015
First Name: Binod
Phone Number: 8845655987
Birth Day: 9-25-2019
First Name: Sunita
Phone Number: 7788456523
Birth Day: 1-22-1998
First Name: Rahul
Phone Number: 1122334455
Birth Day: 1-1-2000
*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 2
Enter the name to search: Dinku
No record found on name: Dinku
*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 2
Enter the name to search: Pyari
First Name: Pyari
Phone Number: 9040114545
Birth Day: 8-18-2001
*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 3
Enter the phone number to search: 1212
No record found on contact number: 1212
*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 3
Enter the phone number to search: 1122334455
First Name: Rahul
Phone Number: 1122334455
Birth Day: 1-1-2000
*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 4
Enter the Birthday to search:
Enter the month: 12
Enter the day: 2
Enter the year: 2000
No record found on Birthday: 12-2-2000
*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 5
Enter the name to search: 14
Unable to delete the name 14.
*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 4
Enter the Birthday to search:
Enter the month: 5
Enter the day: 14
Enter the year: 2011
First Name: Mohan
Phone Number: 8942214333
Birth Day: 5-14-2011
*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 5
Enter the name to search: Sunil
Unable to delete the name Sunil.
*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 5
Enter the name to search: Binod
Contact name Binod deleted success fully.
*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 9
*********************** Contact Information ***********************
First Name: Pyari
Phone Number: 9040114545
Birth Day: 8-18-2001
First Name: Mohan
Phone Number: 8942214333
Birth Day: 5-14-2011
First Name: Amit
Phone Number: 7822456789
Birth Day: 9-19-2014
First Name: Suresh
Phone Number: 9822654112
Birth Day: 6-12-2015
First Name: Sunita
Phone Number: 7788456523
Birth Day: 1-22-1998
First Name: Rahul
Phone Number: 1122334455
Birth Day: 1-1-2000
*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 6
Enter the phone number to search: 3322
Unable to delete the phone number 3322.
*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 6
Enter the phone number to search: 9822654112
Contact phone number 9822654112 deleted success fully.
*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 9
*********************** Contact Information ***********************
First Name: Pyari
Phone Number: 9040114545
Birth Day: 8-18-2001
First Name: Mohan
Phone Number: 8942214333
Birth Day: 5-14-2011
First Name: Amit
Phone Number: 7822456789
Birth Day: 9-19-2014
First Name: Sunita
Phone Number: 7788456523
Birth Day: 1-22-1998
First Name: Rahul
Phone Number: 1122334455
Birth Day: 1-1-2000
*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 7
Enter the Birthday to delete:
Enter the month: 1
Enter the day: 12
Enter the year: 1999
Unable to delete the birthday 1-12-1999.
*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 7
Enter the Birthday to delete:
Enter the month: 9
Enter the day: 19
Enter the year: 20014
Unable to delete the birthday 9-19-20014.
*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 9
*********************** Contact Information ***********************
First Name: Pyari
Phone Number: 9040114545
Birth Day: 8-18-2001
First Name: Mohan
Phone Number: 8942214333
Birth Day: 5-14-2011
First Name: Amit
Phone Number: 7822456789
Birth Day: 9-19-2014
First Name: Sunita
Phone Number: 7788456523
Birth Day: 1-22-1998
First Name: Rahul
Phone Number: 1122334455
Birth Day: 1-1-2000
*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 7
Enter the Birthday to delete:
Enter the month: 9
Enter the day: 19
Enter the year: 2014
Contact Birthday 9-19-2014 deleted success fully.
*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 9
*********************** Contact Information ***********************
First Name: Pyari
Phone Number: 9040114545
Birth Day: 8-18-2001
First Name: Mohan
Phone Number: 8942214333
Birth Day: 5-14-2011
First Name: Sunita
Phone Number: 7788456523
Birth Day: 1-22-1998
First Name: Rahul
Phone Number: 1122334455
Birth Day: 1-1-2000
*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 8
Number of contact records 4
*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 10
File Write Successfully Done.
*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 19
Invalid Choice........
*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 12
ContactInfo.txt file contents
Pyari 9040114545 8 18 2001
Mohan 8942214333 5 14 2011
Amit 7822456789 9 19 2014
Suresh 9822654112 6 12 2015
Binod 8845655987 9 25 2019
Sunita 7788456523 1 22 1998