#include //#include using namespace std; const int MAX_LIST_SIZE = 25; const int PHONE_SIZE = 5; const int MOBILE = 0; const int HOME = 1; const int WORK = 2; const int FAX = 3; const int OTHER = 4; const int COM = 0; const int EDU = 1; const int GOV = 2; const int NET = 3; int lastList = 0; struct Pnumber{ int areaCode; int exchange; int extention; int pType; }; struct Email{ string username; string secondDomain; int firstDomain; }; struct Contact{ int lastNumberUsed; string name; Pnumber numbers[PHONE_SIZE]; Email address; }; Contact phonebook[MAX_LIST_SIZE]; void addPhoneNumber(){ int numberOfPhones; cout<<"How many phone numbers would you like to enter? (Max 5)"<>numberOfPhones; for(int i=0; i>phoneNumber; string tempArea= phoneNumber.substr(0,3); string tempExchange= phoneNumber.substr(4,6); string tempExtention= phoneNumber.substr(8,10); phonebook[lastList].numbers[i].areaCode= atoi(tempArea.c_str()); phonebook[lastList].numbers[i].exchange= atoi(tempExchange.c_str()); phonebook[lastList].numbers[i].extention= atoi(tempExtention.c_str()); cout<<"What type of phone number is this:"<>type; switch(type){ case 'M': phonebook[lastList].numbers[i].pType = MOBILE; case 'W': phonebook[lastList].numbers[i].pType = WORK; case 'H': phonebook[lastList].numbers[i].pType = HOME; case 'F': phonebook[lastList].numbers[i].pType = FAX; case 'O': phonebook[lastList].numbers[i].pType = OTHER; default: cout<<"Please choose an option from the menu"<>tempEmail; int locationOfAt = tempEmail.find('@'); int locationOfDot = tempEmail.rfind('.'); string tempUserName= tempEmail.substr(0,locationOfAt); string tempSecondDomain= tempEmail.substr(locationOfAt,locationOfDot); string tempFirstDomain= tempEmail.substr(locationOfDot+1,locationOfDot+4); phonebook[lastList].address.username= atoi(tempUserName.c_str()); phonebook[lastList].address.secondDomain= atoi(tempUserName.c_str()); if(tempFirstDomain=="edu"||"EDU"){ phonebook[lastList].address.firstDomain= EDU; } if(tempFirstDomain=="gov"||"GOV"){ phonebook[lastList].address.firstDomain= GOV; } if(tempFirstDomain=="net"||"NET"){ phonebook[lastList].address.firstDomain= NET; } if(tempFirstDomain=="com"||"COM"){ phonebook[lastList].address.firstDomain= COM; } } void addContact(){ char input; string tempName; cout<<"Please enter the name of the new contact"<>tempName; phonebook[lastList].name=tempName; cout<<"Would you like to add a phone number for this contact? (Y or N)"<>input; switch(input){ case 'Y': addPhoneNumber(); case 'N': break; default: cout<<"Please choose either 'Y' or 'N'"<>input; switch(input){ case 'Y': addEmail(); case 'N': cout<<"Would you like to add another contact?"<>choice; switch(choice){ case 'Y': addContact(); case 'N': exit(0); } } /* void addAnother(){ cout<<"Would you like to add another contact? ('Y' or'N'"<>choice; switch(choice){ case 'Y': addContact(); case 'N': exit(0); } } */ void printMenu(){ char menuChoice; cout<<"Please Choose from one of the following 4 options:"<>menuChoice; switch(menuChoice){ //if the user uses uppercase case 'A': addContact(); break; case 'D': cout<<"Feature coming soon!"<