Kat H.

asked • 06/28/21

Create a C++ program that uses an array of struct Contact values.

Create a program that uses an array of struct Contact values. Please include source code.


What to code


The Contact struct is defined as follows:


Contact has:

• name

• phoneNumber

• email


A PhoneNumber has:


• areaCode -> 3 digit regional code

• prefix -> first 3 digits

• suffix -> last 4 digits


associated with a phone number in 3 separate fields.


You can model the PhoneNumber as a separate struct and use it inside the Contact struct. Or you can just put the phone info in as separate fields. But you need to have at least the Contact struct in your code.


Then have your program ask the user for all the information for a contact. Use getline() for the name (names might have spaces). Also ask if they want to quit (please put this in; I won't be typing 100 contacts in!).


When the user is done, print out the contact information. See below for example output.


Requirements


You need to have an array of 100 Contact structs. All string fields should be C strings

only; no string type!


-----------------------

EXAMPLE OUTPUT #1

-----------------------

== Contact 1

Enter Name: Helen Wecker

Enter Phone Number's Area Code: 234

Enter Phone Number's Prefix: 535

Enter Phone Number's Suffix: 2364

Enter email: [email protected]

Do you want to add another? ('y' or 'n') y

== Contact 2

Enter Name: Maria Hernandez

Enter Phone Number's Area Code: 325

Enter Phone Number's Prefix: 908

Enter Phone Number's Suffix: 2352

Enter email: [email protected]

Do you want to add another? ('y' or 'n') n


Printing Contacts


== Contact 1

Name: Helen Wecker

Phone Number: (234) 535 - 2364

Email: [email protected]

== Contact 2

Name: Maria Hernandez

Phone Number: (325) 908 - 2352

Email: [email protected]


Patrick B.

Again, there is not enough room to post all of source code needed. There is 2000 character limit. You can email me by clicking on my picture in my profile. There will be a link to send me an email
Report

06/30/21

1 Expert Answer

By:

Patrick B. answered • 06/30/21

Tutor
4.7 (31)

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.