Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You are asked with writing a program that manages contact information for a grou

ID: 3787550 • Letter: Y

Question

You are asked with writing a program that manages contact information for a group of people.
The program should save the rst name, last name, and telephone number for up to 12 people.
The program should have options to add a person, delete a person, update the information for
a person, and display all information for all current entries. How could you go about breaking
up the programming work into a set of subproblems that could be implemented separately?

Describe the subproblems, the order in which you would work on them, and any testing you
would do for each subproblem before proceeding to the next.

Write program in C?

Explanation / Answer

#include<stdio.h>
#include<string.h>
#include<conio.h>
#include<stdlib.h>
struct people
{
char firstName[20];
char lastName[20];
long phoneNo;
};
void addPerson( struct people p[] , int n)
{

for(int i=1; i<=n;i++)
{
printf("Enter the %d record ",i);
printf("enter first name: ");
scanf("%s",&p[i].firstName);
printf("enter Last Name : ");
scanf("%s",&p[i].lastName);
printf("enter Phone No : ");
scanf("%ld",&p[i].phoneNo);
printf("------------------------------------ ");

}

}
void showPerson(struct people p[], int n)
{

for(int j=1;j<=n;j++)
{
printf(" First Name is: --> %s ",p[j].firstName);
printf("Last Name is : --> %s ",p[j].lastName);
printf("Phone No is : --> %ld ",p[j].phoneNo);
printf("--------------------------------------- ");
}

}
void deletePerson()
{

}
void updateInfo()
{


}

void main()
{
clrscr();

   people p[12];
int choice;
printf("Please enter your choice to ");
printf(" 1- add Record 2- Display Record 3- Delete record 4- Update Record 5- Exit ");
scanf("%d",&choice);
switch(choice)
{
case 1:

addPerson(p,12);

break;
case 2:
showPerson(p,12);
break;
case 3:
int n;
printf("Enter the record number to be deleted");
scanf("%d",&n);
deletePerson(p,n);
break;
case 4:
break;
case 5:
exit(0);
break;
default:
printf("Wrong Choice");
}

getch();
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote