Advertisement
Guest User

Untitled

a guest
Feb 25th, 2019
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. //char password[15] = "L3tM3in";
  5. //char username[15] = "Admin19";
  6.  
  7. void login();
  8. void menu(int option);
  9.  
  10. int main(int argc, char const *argv[])
  11. {
  12. login();
  13.  
  14.  
  15.  
  16. int option;
  17. //while(option != 4){
  18. printf(" Drug Admin. System\n");
  19. printf("Menu:\n 1. Check Quantity\n 2.Refill\n 3.Dispense\n 4.Quit\n\nSelect Option:\n");
  20. scanf("Enter int %d", &option);
  21. menu(option);
  22.  
  23. //}
  24.  
  25.  
  26. return 0;
  27.  
  28.  
  29.  
  30. }
  31. void menu(int option){
  32.  
  33. if(option == 1){
  34.  
  35.  
  36. }
  37.  
  38.  
  39. }
  40.  
  41.  
  42.  
  43.  
  44. void login(){
  45. char username[15] = "test";
  46. char password[15] = "test";
  47. char username1;
  48. char password1;
  49.  
  50. int nameCorrect = 1;
  51. int passCorrect = 1;
  52. int i = 0;
  53.  
  54. int size = 4;
  55. do {
  56. i = 0;
  57. printf("Enter username:");
  58. username1 = getchar();
  59. while(username1 != '\n'){
  60. if(username[i] != username1){
  61. nameCorrect = 0;
  62. printf("no");
  63. }
  64. i++;
  65. username1 = getchar();
  66.  
  67. }
  68. i = 0;
  69. printf("Enter Password:");
  70. password1 = getchar();
  71. while(password1 !='\n'){
  72. if(password[i] != password1){
  73. printf("no");
  74. passCorrect = 0;
  75. }
  76. i++;
  77. password1 = getchar();
  78.  
  79. }
  80.  
  81. system("@cls||clear");
  82. nameCorrect = 1;
  83. passCorrect = 1;
  84.  
  85. }
  86. while(((nameCorrect != 1) || (passCorrect != 1)) || i != size);
  87.  
  88.  
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement