int main()
{
PERSON p;
int mySwitch;
char *lName = "ppppppppppppppppppppppppppppppppp";//I know it looks weird, I'm sorry. I had a warning and so I did this
char *fName = "LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL";//to initialize...
char access;
cout << "This is an address book that can hold ten people. " << endl;
cout << "Would you like to access the address book? y/n" << endl;
cin >> access;
if(access == 'y')
{
cout << "To enter a contact into the address book, press 1. After you are finished, press 2." << endl;
cout << "To view the entire address book, press 3: " << endl;
cout << "To search the address book by last name, press 4: " << endl;
cout << "To search the address book by last and first name, press 5: " << endl;
cout << "To exit, press any other number. " << endl;
cin >> mySwitch;
while(mySwitch < 6)
{
switch(mySwitch)
{
case 1:
cout << "Enter the first name: " << endl;
cin.getline(p.firstName, 20);
cout << "Enter the last name: " << endl;
cin.getline(p.lastName, 20);
cout << "Enter the address: " << endl;
cin.getline(p.address, 50);
addPerson(p);
cout << "To enter a contact into the address book, press 1. After you are finished, press 2." << endl;
cout << "To view the entire address book, press 3: " << endl;
cout << "To search the address book by last name, press 4: " << endl;
cout << "To search the address book by last and first name, press 5: " << endl;
cout << "To exit, press any other number. " << endl;
cin >> mySwitch;
break;
case 2:
cout << "To view the entire address book, press 3: " << endl;
cout << "To search the address book by last name, press 4: " << endl;
cout << "To search the address book by last and first name, press 5: " << endl;
cout << "To exit, press any other button. " << endl;
cin >> mySwitch;
break;
case 3:
cout << getPerson;
break;
case 4:
cout << "Please enter the last name of the person you would like to view: " << endl;
cin >> lName;
cout << findPerson(lName, p);
break;
case 5:
cout << "Please enter the last and first names of the person you are searching for. " << endl;
cin >> lName >> fName;
cout << findPerson(lName, fName, p);
break;
default:
cout << "Thank you for using the address book." << endl;
exit(0);
break;
}
}
}
else
exit(1);
return 0;
}