Question

developing involves ut from a file a persons first name, last name, phone number and birth a menu driven database applicatio

Breedlove and Albert person has chosen Option 5 from the menu. All other modifications to the data are performed on the array

C++

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include<iostream.h>
int i=0;
int count;
struct Person
{
char fname[30];
char lname[20];
char ph[10];
char dob[10];
}p[20];
void addperson()
{
//reading details of the person
cout<<"Enter firstname";
cin>>p[i].fname;
cout<<"Enter lasname";
cin>>p[i].lname;
cout<<"Enter phone number";
cin>>p[i].ph;
cout<<"Enter Date of birth(DD-MM-YYYY)";
cin>>p[i].dob;
i=i+1;
count=i;
}
void display()
{
// displaying person details
int k;
cout<<"\n Person Details";
for(k=0;k<count;k++)
cout<<"\n Firstname:"<<p[k].fname<<"\n Last name:"<<p[k].lname<<"\n Phone number:"<<p[k].ph<<"\n Date of birth:"<<p[k].dob;
}
void editperson()
{
// modifying the person name
int ch,k;
char name[30],edit[30];
cout<<"Enter name";
cin>>name;
for(k=0;k<count;k++)
{
if(p[k].fname==name)
{
cout<<"\n1. First name.\t 2. Last name.\t 3. Phone number.\t 4. Date of birth";
cin>>ch;
switch(ch)
{
case 1: cout<<"enter firstname";cin>>p[k].fname; break;
case 2: cout<<"enter lastname";cin>>p[k].lname;break;
case 3: cout<<"Enter phone number";cin>>p[k].ph;break;
case 4: cout<<"Enter Date of birth(DD-MM-YYYY)";cin>>p[k].dob;break;
default: break;
}
}
break;
}
}
void findperson()
{
char name[30];
int k;
cout<<"Enter name of the person";
cin>>name;
for(k=0;k<count;k++)
if(p[k].fname==name)
{
cout<<"firsname:"<<p[k].fname;
cout<<"\n lastname:"<<p[k].lname;
cout<<"\n phone number:"<<p[k].ph;
cout<<"\n Date of birth:"<<p[k].dob;
}
else
{
cout<<"\n Person not found";
}
}

void main()
{
int n;
cout<<"\n 1. Find Person.\n 2. Add Person\n 3. Edit Person\n 4. Display.\n 5. Exit";
cin>>n;
do
{
switch(n)
{
case 1: findperson();break;
case 2: addperson();break;
case 3: editperson();break;
case 4: display();break;
case 5: break;
}
}while(n!=5);
}


Add a comment
Know the answer?
Add Answer to:
C++ developing involves ut from a file a person's first name, last name, phone number and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a contacts database program that presents the user with a menu that allows the user...

    Write a contacts database program that presents the user with a menu that allows the user to select between the following options: (In Java) Save a contact. Search for a contact. Print all contacts out to the screen. Quit If the user selects the first option, the user is prompted to enter a person's name and phone number which will get saved at the end of a file named contacts.txt. If the user selects the second option, the program prompts...

  • Create a class “Person” which includes first name, last name, age, gender, salary, and haveKids (Boolean)...

    Create a class “Person” which includes first name, last name, age, gender, salary, and haveKids (Boolean) variables. You have to create constructors and properties for the class. Create a “MatchingDemo” class. In the main function, the program reads the number of people in the database from a “PersonInfo.txt” file and creates a dynamic array of the object. It also reads the peoples information from “PersonInfo.txt” file and saves them into the array. In C# Give the user the ability to...

  • C++ program Write a C++ program to manage a hospital system, the system mainly uses file...

    C++ program Write a C++ program to manage a hospital system, the system mainly uses file handling to perform basic operations like how to add, edit, search, and delete record. Write the following functions: 1. hospital_menu: This function will display the following menu and prompt the user to enter her/his option. The system will keep showing the menu repeatedly until the user selects option 'e' from the menu. Arkansas Children Hospital a. Add new patient record b. Search record c....

  • Serendipity Engineering, Inc. Software Development Project Program Specifications: Serendipity Engineering, Inc. is a small engineering company...

    Serendipity Engineering, Inc. Software Development Project Program Specifications: Serendipity Engineering, Inc. is a small engineering company located in a commercial park. The project manager wants you to develop a customer software package that will allow the company enter the customer information in the computer to keep a customer database. The software will perform the following tasks using menus: Enter Customer Information Display Customer Information Search Customer Information Organize (Sort) Customer Information Add, Delete, Modify, and Look Up Customer Records Save...

  • Lab 3: Databased Admin Tool Python Objective: Develop an admin tool for username and password management. You will need...

    Lab 3: Databased Admin Tool Python Objective: Develop an admin tool for username and password management. You will need to use the best data structure to store the data you read from UD.txt for efficient processing. You can accomplish these tasks with Dictionary or List. The data file (UD.txt) : FIRST NAME, LAST NAME,USERNAME,PASSWORD Sam, DDal,sdd233,Pad231 Dave,Dcon,dcf987, BHYW4fw Dell,Grant,dgr803,Sb83d2d Mike,Kress,mkr212,UNNHS322 Lisa,Kate,lki065,dgw6234 Paul,Edward,ped332,9891ds Youyou,Tranten,ytr876,dsid21kk Nomi,Mhanken,nmh223,3282jd3d2 Write a program that imports the database from UD.txt Give the following options: A: Search by...

  • Serve the user in two phases: In C++ Phase A: (1) Read all input records one...

    Serve the user in two phases: In C++ Phase A: (1) Read all input records one by one into arrays in main memory. (2) Display all the records on the screen in the order they are read from the input data file. (3) Do a Selection Sort (must be implemented as a function) to sort the records in ascending order on STUDENT_ID and display all the full records correctly in the correct order after sorting. Phase B: (1) Then, the...

  • Please solve using c++ plus There are two text files with the following information stored in...

    Please solve using c++ plus There are two text files with the following information stored in them: The instructor.txt file where each line stores the id, name and affiliated department of an instructor separated by a comma The department.txt file where each line stores the name, location and budget of the department separated by a comma You need to write a C++ program that reads these text files and provides user with the following menu: 1. Enter the instructor ID...

  • Write a C++ menu driven Payroll program. Must be user friendly.   Menu 1. Check data file  ...

    Write a C++ menu driven Payroll program. Must be user friendly.   Menu 1. Check data file   2. Read Data file 3. Process payroll for one employee 4. Process payroll for all employees 5. Print out to a text or an HTML file 6. Exit You must use the following Payroll classes, structures, pointers, arrays, enum, vector, recursive, advance file I/O, STL, iterators and containers. The program to process an input file below to calculate tax of 28% and output it...

  • please write in C++ Write a program that uses a structure to store the following inventory...

    please write in C++ Write a program that uses a structure to store the following inventory data in a file: The data can be either read from a text file or the keyboard Item name (string) Quantity on hand(int) Wholesale cost(double) Retail Cost(double) The program should have a menu that allows the user to perform the following tasks: Add new records to the file Display any record in the file User will provide the name of the item or the...

  • Lab 4: Databased Admin Tool Continued Python Objective: In the previous lab, you developed an admin tool for username an...

    Lab 4: Databased Admin Tool Continued Python Objective: In the previous lab, you developed an admin tool for username and password management. You accomplished the tasks with Dictionary or List. Here, use class to design your own data structure to accomplish a similar task. The UD.txt datafile: FIRST NAME, LAST NAME,USERNAME,PASSWORD Sam, DDal,sdd233,Pad231 Dave, Dcon,dcf987, BHYW4fw Dell, Grant,dgr803,Sb83d2d Mike, Kress,mkr212,UNNHS322 Lisa,Kate,lki065,dgw6234 Paul,Edward,ped332,9891ds Youyou,Tranten,ytr876,dsid21kk Nomi,Mhanken,nmh223,3282jd3d2 Write a program that imports the database from UD.txt, your program can search for users’ password....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT