Advertisement
Guest User

test

a guest
Apr 5th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.81 KB | None | 0 0
  1. #include <iostream>
  2. #include <Windows.h>
  3. #include <stdlib.h>
  4. #define _CRT_SECURE_NO_WARNING
  5. using namespace std;
  6.  
  7. void menu_header(void);
  8. void menu1(void);
  9. void menu1_func(void);
  10. void menu2(void);
  11. void menu2_func(void);
  12. void menu_admin(void);
  13. void loading(void);
  14. void option(char action);
  15.  
  16. void daycounter();
  17. void secretword();
  18.  
  19. int main(void)
  20. {
  21. char user[50], password[50];
  22. do
  23. {
  24. system("cls");
  25. cout << "\t\tWelcome" << endl;
  26. cout << "---------------------------------------" << endl;
  27. cout << "Username: ";
  28. cin.getline(user, 50);
  29. cout << "Password: ";
  30. cin.getline(password, 50);
  31.  
  32.  
  33. if ((strcmp(user, "user1")) == 0 && (strcmp(password, "user1") == 0))
  34. {
  35. loading();
  36. cout << "Login successful!" << endl;
  37. Sleep(1000);
  38. menu1();
  39. }
  40. else if ((strcmp(user, "user2")) == 0 && (strcmp(password, "user2") == 0))
  41. {
  42. loading();
  43. cout << "Login successful!" << endl;
  44. Sleep(1000);
  45. menu2();
  46. }
  47. else if ((strcmp(user, "admin")) == 0 && (strcmp(password, "admin") == 0))
  48. {
  49. cout << "Login successful!" << endl;
  50. Sleep(300);
  51. menu_admin();
  52. }
  53. else
  54. {
  55. loading();
  56. cout << "Login denied, Please try again";
  57. Sleep(1000);
  58. }
  59. } while ((strcmp(user, "user1") != 0) || (strcmp(password, "980914") != 0)||(strcmp(user, "user2") != 0) || (strcmp(password, "980711") != 0)||(strcmp(user, "admin") != 0) || (strcmp(password, "admin") != 0));
  60. }
  61.  
  62. void loading(void)
  63. {
  64. cout << "-";
  65. Sleep(300);
  66. cout << "-";
  67. Sleep(300);
  68. cout << "-";
  69. Sleep(300);
  70. cout << "Loading";
  71. Sleep(300);
  72. cout << "-";
  73. Sleep(300);
  74. cout << "-";
  75. Sleep(300);
  76. cout << "-" << endl;
  77. Sleep(300);
  78. }
  79.  
  80. void menu_header(void)
  81. {
  82. cout << "\t\tMenu"<<endl;
  83. cout << "------------------------------------" << endl;
  84. }
  85.  
  86. void menu1_func(void)
  87. {
  88. cout << "1) Day Counter" << endl;
  89.  
  90. }
  91.  
  92. void menu2_func(void)
  93. {
  94. cout << "a) Secret Word Generator" << endl;
  95. }
  96.  
  97. void menu1(void)
  98. {
  99. char action;
  100.  
  101. system("cls");
  102. menu_header();
  103. cout << "Welcome home user1!"<<endl;
  104. menu1_func();
  105. cout << "Please enter your option" << endl;
  106. cin >> action;
  107. option(action);
  108. }
  109.  
  110. void menu2(void)
  111. {
  112. char action;
  113.  
  114. system("cls");
  115. menu_header();
  116. cout << "Welcome home user2!" << endl;
  117. menu2_func();
  118. cout << "Please enter your option" << endl;
  119. cin >> action;
  120. option(action);
  121. }
  122.  
  123. void menu_admin(void)
  124. {
  125. char action;
  126. system("cls");
  127. menu_header();
  128. cout << "Hello Boss! What can I help you?" << endl;
  129. menu1_func();
  130. menu2_func();
  131. cout << "Please enter your option" << endl;
  132. cin >> action;
  133. option(action);
  134. }
  135.  
  136. void option(char action)
  137. {
  138. if (action == 1)
  139. daycounter();
  140. else if (action == 'a' || action == 'A')
  141. secretword();
  142. }
  143.  
  144. void daycounter()
  145. {
  146. cout << "daycounter" << endl;
  147. }
  148.  
  149. void secretword()
  150. {
  151. cout << "secretword" << endl;
  152. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement