Create an application in which a user can enter a phone book entry, including th
ID: 3550095 • Letter: C
Question
Create an application in which a user can enter a phone book entry, including the following elements: First Name, Last Name, Phone Number, email address (add additional elements as desired) Include a search criteria based on last name or any of the elements created for your phone book entries in order to retrieve the information requested. You may use MS Access as your database to store and retrieve from the data of your phone book entries. Be sure to include a write up with your assignment describing the difference of procedural code versus the use of procedural programming conceptually as used in various program languages. Save the project as DatabaseTools.cs. Embed the program in a Microsoft Word document.
Explanation / Answer
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct PhoneBook
{
char FirstName[50]; //Entered First Name
char LastName[50]; //Entered Last Name
char PhoneNumber[50]; //Phone Number
} phone; //TypeDef to Modify structure name
void AddEntry (phone *); //Function prototype to Add Entries
void DeleteEntry (phone *); //Function prototype to Delete Entries
void PrintEntries (phone *); //Function prototype to Display Entries
char deleteFirstName[50] = {''};
char deleteLastName[50] = {''};
int x;
//Begin main function
main ()
{
int x;
phone phonebook[100];
const int iSelection = 0;
while (iSelection != 4)
{
printf(" Phonebook Menu");
printf(" (1) Add Friend");
printf(" (2) Delete Friend");
printf(" (3) Display Phonebook Entries");
printf(" (4) Exit Phonebook");
printf(" What would you like to do? ");
scanf("%d", &iSelection);
if (iSelection == 1)
{
AddEntry (phone *);
} //End if
if (iSelection == 2)
{
void DeleteEntry ();
} //End if
if (iSelection == 3)
{
void PrintEntries ();
} //End if
if (iSelection == 4)
{
printf("The Phonebook will now exit.");
system("cls");
} //End if
} //End while
} //End main function
void AddEntry (phone * phonebook)
{
printf("First Name: ");
scanf("%s", phonebook[x].FirstName);
printf("Last Name: ");
scanf("%s", phonebook[x].LastName);
printf("Phone Number: ");
scanf("%s", phonebook[x].PhoneNumber);
printf("Friend successfully added to Phonebook");
} //End Adding Entries
void DeleteEntry (phone * phonebook)
{
printf("First Name: ");
scanf("%s", deleteFirstName);
printf("Last Name: ");
scanf("%s", deleteLastName);
if (strcmp(phonebook[x].FirstName, deleteFirstName) == 0 && strcmp(phonebook[x].LastName, deleteLastName) == 0)
{
printf("Friend successfully deleted from Phonebook");
}
else
{
printf("Invalid Entry");
}
} //End Deleteing Entries
void PrintEntries (phone * phonebook)
{
for (x = 0; x <= 99; x++)
printf("First Name: %s ", phonebook[x].FirstName);
printf("Lsat Name: %s ", phonebook[x].LastName);
printf("Number: %s ", phonebook[x].PhoneNumber);
} //End Printing Entries
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.