Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <math.h>
- //char password[15] = "L3tM3in";
- //char username[15] = "Admin19";
- void login();
- void menu(int *option);
- int main()
- {
- //login();
- int option = 0;
- while(option != 4){
- printf(" Drug Admin. System\n");
- printf("Menu:\n 1. Check Quantity\n 2.Refill\n 3.Dispense\n 4.Quit\n\nSelect Option:\n");
- scanf("%d", &option);
- menu(&option);
- }
- return 0;
- }
- void menu(int *option){
- int a = 40; //Amoxil
- int s = 40; //Synthroid
- int z = 30;//Zestril
- int v = 10;//Vicodin
- switch(*option){
- case(1):
- system("@cls||clear");
- printf(" Current Quantities\n");
- printf("Amoxil %d\nSynthroid %d\nZestril %d\nVicodin %d\n\n", a, s, z, v);
- getchar();
- char pick;
- char next;
- int count = 0;
- while(pick != 'b' || count != 2){
- count = 0;
- next = 'c';
- printf("Return to menu press b: \n");
- while(next != '\n'){
- next = getchar();
- if(count == 0){
- pick = next;
- printf("Pick equals: %c\n", pick);
- }
- count++;
- }
- printf("Count: %d\n", count);
- }
- case(2):
- system("@cls||clear");
- }
- }
- /*system("@cls||clear");
- printf(" Current Quantities\n");
- printf("Amoxid %d\nSynthroid %d\nZestril %d\nVicodin %d\n", a, s, z, v);
- char returnMenu[2] = {'n', '\0'};
- char returnMenu1;
- int returnCorrect = 1;
- int i;
- do{
- returnCorrect = 1;
- i = 0;
- printf("Return to menu press b: \n");
- returnMenu1 = getchar();
- while(returnMenu1 != '\n'){
- if(returnMenu[i] != returnMenu1){
- returnCorrect = 0;
- printf("no");
- }
- i++;
- returnMenu1 = getchar();
- }
- system("@cls||clear");
- }while(returnCorrect != 1);
- } */
- /*do{
- printf("Return to menu press b: \n");
- pick = getchar();
- getchar();
- }while(pick != 'b');
- while(pick[0] == 'b'){
- break;
- }
- }while ()
- }
- }
- //printf("Return to menu press b: \n");
- //pick = getchar();
- /*printf("%d", *option);
- if(*option == 1){
- system("@cls||clear");
- printf("Amoxil %d\nSynthroid %d\nZestril %d\nVicodin %d\n\n", a, s, z, v);
- getchar();
- char pick;
- do{
- printf("Return to menu press b: \n");
- pick = getchar();
- getchar();
- }while(pick != 'b');
- while(pick == 'b'){
- break;
- }
- }
- else if(*option == 2){
- }else if(*option == 3){
- }
- else{
- printf("Quit Program\n");
- } */
- void login()
- {
- char username[15] = "test";
- char password[15] = "test";
- char username1;
- char password1;
- int nameCorrect = 1;
- int passCorrect = 1;
- int i = 0;
- int j = 0;
- int size = 4;
- do{
- nameCorrect = 1;
- passCorrect = 1;
- i = 0;
- printf("Enter username:");
- username1 = getchar();
- while(username1 != '\n'){
- if(username[i] != username1){
- nameCorrect = 0;
- printf("no");
- }
- i++;
- username1 = getchar();
- }
- j = 0;
- printf("Enter Password:");
- password1 = getchar();
- while(password1 !='\n'){
- if(password[j] != password1){
- passCorrect = 0;
- }
- j++;
- password1 = getchar();
- }
- system("@cls||clear");
- }while(((nameCorrect != 1) || (passCorrect != 1)) || i != size || j != size);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement