Advertisement
chunyin_Lee

Untitled

Dec 29th, 2015
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.83 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. #include<string>
  4.  
  5. int menu()
  6. {
  7. int k;
  8. cout << endl << endl << "***********MAIN MENU***********" << endl;
  9. cout << "1. Initialize the address book" << endl;
  10. cout << "2. Create person contact information" << endl;
  11. cout << "3. Lookup person contact inforamtion" << endl;
  12. cout << "4. Look all person contact inforamtion" << endl;
  13. cout << "5. Quit " << endl;
  14. cout << endl << "Please enter your chioce <1, 2, 3, 4 or 5 to exit :" << endl;
  15. cin >> k;
  16. if (k > 5 || k < 0)
  17. {
  18. cout << "Invalid input!Please enter again!";
  19. menu();
  20. }
  21. if (k == 1)
  22. {
  23. addressbook();
  24. }
  25. if (k == 2)
  26. {
  27. cpersoninfo();
  28. }
  29. if (k == 3)
  30. {
  31. lpersoninfo();
  32. }
  33. if (k == 4)
  34. {
  35. lapersoninfo();
  36. }
  37. if (k == 5)
  38. {
  39. cout << "Goodbye";
  40. return 0;
  41. }
  42. }
  43. void addressbook()
  44. {
  45. int i = 0;
  46. int x = 1;
  47. string name[101] = { "" };
  48. string email[101] = { "" };
  49. string tele[101] = { "" };
  50. name[1] = {Lawrence Cheung};
  51. cout << "Name is : " << name[1] << endl;
  52. email[1] = { enccl@eie.polyu.edu.hk };
  53. cout << "Email is : " << email[1] << endl;
  54. tele[1] = { 27666131 };
  55. cout << "Telephone number is : " << tele[1];
  56.  
  57. name[2] = { Helen Wong };
  58. cout << "Name is : " << name[2] << endl;
  59. email[2] = { helenwong@yahoo.com.hk };
  60. cout << "Email is : " << email[2] << endl;
  61. tele[2] = { 94665888 };
  62. cout << "Telephone number is : " << tele[2];
  63.  
  64. name[3] = { Simon Sui};
  65. cout << "Name is : " << name[3] << endl;
  66. email[3] = { ss123@gmail.com };
  67. cout << "Email is : " << email[3] << endl;
  68. tele[3] = { 64441234 };
  69. cout << "Telephone number is : " << tele[3];
  70.  
  71. name[4] = {Mary Ho };
  72. cout << "Name is : " << name[4] << endl;
  73. email[4] = { ho.mary10@netvigator.com };
  74. cout << "Email is : " << email[4] << endl;
  75. tele[4] = { 21111112 };
  76. cout << "Telephone number is : " << tele[4];
  77.  
  78.  
  79. cout << "Initialization is completed ." << endl;
  80. menu();
  81.  
  82.  
  83. }
  84. void cpersoninfo()
  85. {
  86. int max;
  87. int ii;
  88. cout << "Please enter the total number of records to be created";
  89. cin >> max;
  90. while (max < 0 || max>10)
  91. {
  92. cout << "The input is invalid . It must be an integer not greater than 10 .";
  93. cout << "Please enter the total number of records to be created";
  94. cin >> max;
  95. }
  96. for (int i = 0;i < max;i++)
  97. {
  98. cout << "Full name : ";
  99. cin >>
  100. cout << "Email address : ";
  101. cin >>
  102. cout << "8-digit telephone number : ";
  103. cin>>
  104.  
  105.  
  106. }
  107. }
  108. void lpersoninfo()
  109. {
  110. char kk;
  111. cout << endl << endl << "***********SUB-MENU***********" << endl;
  112. cout << "a. Search record by name " << endl;
  113. cout << "b. Search record by email address " << endl;
  114. cout << "c. Search record by telephone number" << endl;
  115. cout << "d. Return to main menu" << endl << endl;
  116. cout<<"Please enter your chioce < a, b, c or d to return> : ";
  117.  
  118. get(cin, kk);
  119.  
  120.  
  121.  
  122. }
  123.  
  124.  
  125. int main()
  126. {
  127. menu();
  128. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement