Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
971 B
2
Indexable
Never
#include "medicina.h"



int menu() {

    int opt = 0;

    printf("Hello! Welcome to the Medicina's menu!\n");
    printf("\t1 - Add a new patient\n");
    printf("\t2 - Remove a patient\n");
    printf("\t3 - Show all patients\n");
    printf("\t4 - Exit\n");

    printf("\nChoose an option: ");
    scanf("%d", &opt);

    return opt;
}


Medicina busca(Medicina medicina, char nombre[50]) {

    char aux, basura;

    if(strcmp(nombre, medicina.name) == 0) {
        printf("Name: %s", medicina.name);
        printf("Brand: %s", medicina.brand);
        printf("Price: %f", medicina.price);
        printf("Stock: %d", medicina.stock);
        if(medicina.stock == 0) {
            printf("Do u want to refill? (y/n): ");
            scanf("%c", &aux);
            scanf("%c", &basura);
            if(aux == 'y') {
                medicina.refill = 1;
            }else {
                medicina.refill = 0;
            }
        }
    }

    return medicina;
}