Advertisement
Guest User

Untitled

a guest
Feb 26th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.08 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <math.h>
  5.  
  6. //char password[15] = "L3tM3in";
  7. //char username[15] = "Admin19";
  8.  
  9. void login();
  10. void menu(int *option);
  11.  
  12. int main()
  13. {
  14. //login();
  15.  
  16.  
  17.  
  18. int option = 0;
  19. while(option != 4){
  20. printf(" Drug Admin. System\n");
  21. printf("Menu:\n 1. Check Quantity\n 2.Refill\n 3.Dispense\n 4.Quit\n\nSelect Option:\n");
  22. scanf("%d", &option);
  23. menu(&option);
  24.  
  25. }
  26.  
  27.  
  28. return 0;
  29.  
  30.  
  31.  
  32. }
  33. void menu(int *option){
  34.  
  35. int a = 40; //Amoxil
  36. int s = 40; //Synthroid
  37. int z = 30;//Zestril
  38. int v = 10;//Vicodin
  39.  
  40. switch(*option){
  41. case(1):
  42. system("@cls||clear");
  43. printf(" Current Quantities\n");
  44. printf("Amoxil %d\nSynthroid %d\nZestril %d\nVicodin %d\n\n", a, s, z, v);
  45. getchar();
  46. char pick;
  47. char next;
  48. int count = 0;
  49. while(pick != 'b' || count != 2){
  50. count = 0;
  51. next = 'c';
  52. printf("Return to menu press b: \n");
  53. while(next != '\n'){
  54. next = getchar();
  55. if(count == 0){
  56. pick = next;
  57. printf("Pick equals: %c\n", pick);
  58.  
  59. }
  60.  
  61. count++;
  62.  
  63. }
  64. printf("Count: %d\n", count);
  65.  
  66.  
  67.  
  68.  
  69.  
  70. }
  71. case(2):
  72. system("@cls||clear");
  73.  
  74.  
  75. }
  76.  
  77.  
  78.  
  79.  
  80.  
  81. }
  82.  
  83.  
  84.  
  85. /*system("@cls||clear");
  86. printf(" Current Quantities\n");
  87. printf("Amoxid %d\nSynthroid %d\nZestril %d\nVicodin %d\n", a, s, z, v);
  88. char returnMenu[2] = {'n', '\0'};
  89. char returnMenu1;
  90.  
  91. int returnCorrect = 1;
  92.  
  93. int i;
  94.  
  95.  
  96.  
  97. do{
  98. returnCorrect = 1;
  99. i = 0;
  100. printf("Return to menu press b: \n");
  101. returnMenu1 = getchar();
  102. while(returnMenu1 != '\n'){
  103. if(returnMenu[i] != returnMenu1){
  104. returnCorrect = 0;
  105. printf("no");
  106.  
  107. }
  108.  
  109. i++;
  110. returnMenu1 = getchar();
  111.  
  112. }
  113.  
  114. system("@cls||clear");
  115. }while(returnCorrect != 1);
  116. } */
  117.  
  118.  
  119.  
  120.  
  121. /*do{
  122. printf("Return to menu press b: \n");
  123. pick = getchar();
  124. getchar();
  125.  
  126. }while(pick != 'b');
  127.  
  128. while(pick[0] == 'b'){
  129. break;
  130.  
  131. }
  132.  
  133.  
  134. }while ()
  135.  
  136.  
  137.  
  138. }
  139. }
  140. //printf("Return to menu press b: \n");
  141. //pick = getchar();
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150. /*printf("%d", *option);
  151. if(*option == 1){
  152. system("@cls||clear");
  153. printf("Amoxil %d\nSynthroid %d\nZestril %d\nVicodin %d\n\n", a, s, z, v);
  154. getchar();
  155. char pick;
  156. do{
  157. printf("Return to menu press b: \n");
  158. pick = getchar();
  159. getchar();
  160.  
  161.  
  162.  
  163. }while(pick != 'b');
  164. while(pick == 'b'){
  165. break;
  166. }
  167.  
  168.  
  169.  
  170. }
  171. else if(*option == 2){
  172.  
  173.  
  174. }else if(*option == 3){
  175.  
  176.  
  177. }
  178. else{
  179.  
  180. printf("Quit Program\n");
  181.  
  182.  
  183. } */
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191. void login()
  192. {
  193. char username[15] = "test";
  194. char password[15] = "test";
  195. char username1;
  196. char password1;
  197.  
  198. int nameCorrect = 1;
  199. int passCorrect = 1;
  200. int i = 0;
  201. int j = 0;
  202.  
  203. int size = 4;
  204. do{
  205.  
  206. nameCorrect = 1;
  207. passCorrect = 1;
  208. i = 0;
  209. printf("Enter username:");
  210. username1 = getchar();
  211. while(username1 != '\n'){
  212. if(username[i] != username1){
  213. nameCorrect = 0;
  214. printf("no");
  215.  
  216. }
  217. i++;
  218. username1 = getchar();
  219.  
  220. }
  221. j = 0;
  222. printf("Enter Password:");
  223. password1 = getchar();
  224. while(password1 !='\n'){
  225. if(password[j] != password1){
  226. passCorrect = 0;
  227.  
  228. }
  229. j++;
  230. password1 = getchar();
  231.  
  232. }
  233.  
  234. system("@cls||clear");
  235.  
  236.  
  237. }while(((nameCorrect != 1) || (passCorrect != 1)) || i != size || j != size);
  238.  
  239.  
  240. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement