(Solved) : Write C Program Used Sort Search Report Database Personal Contacts Phone Numbers Birth Day Q42732086 . . .

Write a C++ Program that can be used to sort, search and reporta database of personal contacts, phone numbers, birth day, andaddress. The birth day should be type Date (a struct with month asstring, day and year as integers). All the input data are saved ina file. The output file should have the sorted data based on thelast names. Also, search with a birthday month, and should reportall those persons name and birthdays whose birthday is in thatmonth.

Use functional decomposition to solve the problem. Generate Datafile of at least 20 records to test your code.

The program must use functions, structs, and arrays.


First split the program into several parts:

1. Define three structs called Address, Date and Record asbelow:

struct Address


   int houseno;

   string streetname;

   string streetType;

   string city;

   string state;

   int zip;


struct Date


   string month;

   int day;

   int year;


struct Record


   string last;

   string first;

   Date bday;      // Dateitself is a struct as defined above;

   Address address;

   int phoneNo;



2. Functions:

Main (You have to change the order to make it to work, here onlyimportant steps are provided)

Must declare an array of type Record, declare itdynamically.

Declare N (total number of records)

Use file input option to read all the records from an input filewhere all the data are stored.

Now declare a variable called option, and get a value for optionusing cin statement. Display a menu like the below:

To sort the records: Option is 1

To search with a search criterion: Option is 2

If option = 1, then do the following:

   Declare SortOption as integer


    Display menu:

    Enter 1 to sort using first name

    Enter 2 to sort using last name

    Enter 3 to sort using birth month

    Prompt the user to enter sort option

    Get a value for sortOption using cinstatement

    Call the function Sort that takes threeinputs: record array of type Record, N, and


Call Display function to display allthe records after sorting. Display function displays the records insorted order as well as put the sorted list in an output file.

If option = 2, then

   Declare a variable called birthMonth as typeinteger

   Prompt the user to enter a month

   Get value for birthMonth using cin statement

   Call the function Search that takes the recordarray, number of records (N) and birthMonth as inputs and willdisplay only those persons name, their birthdate and phone numberwhose birthdays are falling in that month.

End main


Function Sort will sort all the records based on the criterionselected.

Function Search will search with birthMonth, and displaycorresponding records.

Function Display will display all the records

PROJECT must include (i) Source code (.cpp) withcomments added. Comments must be sufficient to explain yourprogram. About the two functions take help fromblackboard.

(ii) A flow chart explaining the details.

(iii) Result files

iv) Report (a word document)

Expert Answer

Answer to Write a C++ Program that can be used to sort, search and report a database of personal contacts, phone numbers, birth da…

Leave a Comment


We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.

Quick Links

Browse Solutions

Place Order

About Us

× How can I help you?