Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- #include<string>
- int menu()
- {
- int k;
- cout << endl << endl << "***********MAIN MENU***********" << endl;
- cout << "1. Initialize the address book" << endl;
- cout << "2. Create person contact information" << endl;
- cout << "3. Lookup person contact inforamtion" << endl;
- cout << "4. Look all person contact inforamtion" << endl;
- cout << "5. Quit " << endl;
- cout << endl << "Please enter your chioce <1, 2, 3, 4 or 5 to exit :" << endl;
- cin >> k;
- if (k > 5 || k < 0)
- {
- cout << "Invalid input!Please enter again!";
- menu();
- }
- if (k == 1)
- {
- addressbook();
- }
- if (k == 2)
- {
- cpersoninfo();
- }
- if (k == 3)
- {
- lpersoninfo();
- }
- if (k == 4)
- {
- lapersoninfo();
- }
- if (k == 5)
- {
- cout << "Goodbye";
- return 0;
- }
- }
- void addressbook()
- {
- int i = 0;
- int x = 1;
- string name[101] = { "" };
- string email[101] = { "" };
- string tele[101] = { "" };
- name[1] = {Lawrence Cheung};
- cout << "Name is : " << name[1] << endl;
- email[1] = { enccl@eie.polyu.edu.hk };
- cout << "Email is : " << email[1] << endl;
- tele[1] = { 27666131 };
- cout << "Telephone number is : " << tele[1];
- name[2] = { Helen Wong };
- cout << "Name is : " << name[2] << endl;
- email[2] = { helenwong@yahoo.com.hk };
- cout << "Email is : " << email[2] << endl;
- tele[2] = { 94665888 };
- cout << "Telephone number is : " << tele[2];
- name[3] = { Simon Sui};
- cout << "Name is : " << name[3] << endl;
- email[3] = { ss123@gmail.com };
- cout << "Email is : " << email[3] << endl;
- tele[3] = { 64441234 };
- cout << "Telephone number is : " << tele[3];
- name[4] = {Mary Ho };
- cout << "Name is : " << name[4] << endl;
- email[4] = { ho.mary10@netvigator.com };
- cout << "Email is : " << email[4] << endl;
- tele[4] = { 21111112 };
- cout << "Telephone number is : " << tele[4];
- cout << "Initialization is completed ." << endl;
- menu();
- }
- void cpersoninfo()
- {
- int max;
- int ii;
- cout << "Please enter the total number of records to be created";
- cin >> max;
- while (max < 0 || max>10)
- {
- cout << "The input is invalid . It must be an integer not greater than 10 .";
- cout << "Please enter the total number of records to be created";
- cin >> max;
- }
- for (int i = 0;i < max;i++)
- {
- cout << "Full name : ";
- cin >>
- cout << "Email address : ";
- cin >>
- cout << "8-digit telephone number : ";
- cin>>
- }
- }
- void lpersoninfo()
- {
- char kk;
- cout << endl << endl << "***********SUB-MENU***********" << endl;
- cout << "a. Search record by name " << endl;
- cout << "b. Search record by email address " << endl;
- cout << "c. Search record by telephone number" << endl;
- cout << "d. Return to main menu" << endl << endl;
- cout<<"Please enter your chioce < a, b, c or d to return> : ";
- get(cin, kk);
- }
- int main()
- {
- menu();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement