182k views
4 votes
Create a console application to keep track of contact information. Print the contacts of the address book in sorted order first by last name, then by first. For each person in the address book have fields for: First Name Last Name Phone Number Email Address

User Davydotcom
by
4.6k points

1 Answer

4 votes

Answer:

The code is written in C++ below with appropriate comments

Step-by-step explanation:

#include <iostream>

#include <cstring> //this takes care of the customer details

//that will be imputed into the program

using namespace std;

//using user-defined struct format to store contact details

struct Contact{

char FirstName [60]; //character string for first name

char LastName [60]; //character string for last name

char PhoneNumber [30]; //character string for phone number

//this takes care of cases where international format is used

char Email [40]; //character string for email

};

int main()

{

//case example for storing values of a contact called John

Contact John;

//strcpy is used to assign character strings

//to user-defined structs

strcpy(John.FirstName,"John");

strcpy(John.LastName, "Doe");

strcpy(John.PhoneNumber,"+1234567890");

strcpy(John.Email, "johndoe @ nomail . com");

//added spaces due to regulations

//this has stored the information of Joe

//printing the contact name

cout<<"The customer is:"<<John.LastName<<" "<<John.FirstName;

//prints out the last name then first name as given

//you can edit it for the desired customers

}

User Komatsu
by
5.2k points