Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //main
- #include <iostream>
- #include <iomanip>
- #include "mindtap_10_11_header.h"
- using namespace std;
- void menu(personType newPerson)
- {
- int selection = 0;
- char answer;
- string first, middle, last;
- cout << "Would you like to use the Program?(Y/N) \n";
- cin >> answer;
- while (answer == 'y' || answer == 'Y') {
- cout << "Please enter your selection: \n";
- cout << "1. Print Name.\n";
- cout << "2. Set Full Name.\n";
- cout << "3. Set First Name.\n";
- cout << "4. Set Middle Name.\n";
- cout << "5. Set Last Name.\n";
- cout << "6. Exit.\n";
- cin >> selection;
- if (selection == 1)
- newPerson.printName();
- else if (selection == 2)
- newPerson.setName(first, middle, last);
- else if (selection == 3)
- newPerson.setFName(first);
- else if (selection == 4)
- newPerson.setMName(middle);
- else if (selection == 5)
- newPerson.setLName(last);
- else if (selection == 6)
- exit(0);
- else
- cout << "Please enter a valid selection (1-6)\n";
- }
- };
- int main()
- {
- personType newPerson;
- menu(newPerson);
- return 0;
- };
Add Comment
Please, Sign In to add comment