Question: C + + , Write a program about Citizen s Database. Use main.cpp , person.cpp , person.h and person.txt . follow below: Create a user
C Write a program about Citizens Database.
Use main.cpp person.cpp person.h and person.txt follow below:
Create a userdefined data type called a struct
Create an array of structs
Use Cstrings for all string data types
Shift and insert data in the right position in an array
Task
Download the final.zip file and extract the files into a folder of your own on your computer.
You can modify the provided person.h person.cpp and main.cpp per the instructions in this document. You are not allowed to use or any other header files in STL
For this test, you will need to create the following function. First add the function prototype to person.h then put the function implementation in person.cpp and finally invoketest the function in main.cpp Please label your output clearly. EgAfter adding a person, the list is:
Create a function to read a persons information and insert into the list at a given position. The function returns true if the insertion is successful and it returns false if the array is out of capacity.
bool addPersonPersonType list int &count;
Sample code in person.cpp
PersonType aPerson;
read in person name, person citizenship, and age and populate aPerson
eg strcpyaPersonname, tempName
read position to insert inside the function see sample run
position could be read from the user or you could set a number that is not more than count. If you read from the user check to make sure position is not than count.
shift and insert aPerson in the right position
Sample test code in main.cpp
ifaddPersonlist count true
output list
You must be able to read cstrings with spaces. You must use cin.getline to read strings.
You must not replace any existing values in the list. You must shift and insert in the right position. See zybooks Lab for reference.
You must be able to add at the beginning of the list and at the end if your list has elements, users must be able to insert at position through
See Sample Runs below and test your code multiple times adding users at the beginning and at the end.
You must make sure the position is within count.
You must check for unreasonable age for example: age and age can be unreasonable
Include a welcome and goodbye message. See sample run below
Must use all the given function prototypes under Task exactly as is Function Prototypes and implementations must be written in the appropriate files.
Do not add header comments for this exam, but you must have function comments for the function you are writing.
Do not use containers of any sort or any vectors for this program. Use only the concepts we have learned so fa
Sample run:
Welcome to my Citizens Database.
Here is your list so far:
Gayathri;USA;
Stephanie;USA;
Priya;India;
Ahmed;Nigeria;
Enter your name:
Navid
Enter your citizenship:
Ecuador
Enter your age:
Enter position number:
After adding a person, the list is:
Gayathri;USA;
Stephanie;USA;
Navid;Ecuador;
Priya;India;
Ahmed;Nigeria;
Thank you for using my Citizen Database!!
Welcome to my Citizens Database.
Here is your list so far:
Gayathri;USA;
Stephanie;USA;
Priya;India;
Ahmed;Nigeria;
Enter your name:
Navid
Enter your citizenship:
Ecuador
Enter your age:
Enter position number:
Error! Invalid position.
Thank you for using my Citizen Database!!
Welcome to my Citizens Database.
Here is your list so far:
Gayathri;USA;
Stephanie;USA;
Priya;India;
Ahmed;Nigeria;
Enter your name:
Lucy
Enter your citizenship:
Ecuador
Enter your age:
Enter position number:
After adding a person, the list is:
Lucy;Ecuador;
Gayathri;USA;
Stephanie;USA;
Priya;India;
Ahmed;Nigeria;
Thank you for using my Citizen Database!!
Welcome to my Citizens Database.
Here is your list so far:
Gayathri;USA;
Stephanie;USA;
Priya;India;
Ahmed;Nigeria;
Enter your name:
Arely
Enter your citizenship:
Mexico
Enter your age:
Enter position number:
After adding a person, the list is:
Gayathri;USA;
Stephanie;USA;
Priya;India;
Ahmed;Nigeria;
Arely;Mexico;
Thank you for using my Citizen Database!!
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
