C语言课程设计(药店管理系统包含链表和文件)

本文分享了一次C语言课程设计的经历,项目是一个药店管理系统,重点涉及链表和文件操作。作者在完成过程中面临挑战,通过学习和搜索资料最终完成。文章附带了main.c和singlelist.h的代码片段,并祝愿所有进行类似课设的同学都能顺利过关。
摘要由CSDN通过智能技术生成

在疫情期间,由于学校通知我们课程设计不受物理环境的限制,于是C语言课设如约而至。。。刚刚结束的C语言课程设计的确非常煎熬(还不是c语言没有学好嘛),想必也会有很多人像我一样在网上到处找代码,或是恶补链表文件的知识点,但最后还是在网上苦苦的寻找符合老师要求的代码,话不多说,直接上代码。

#include "singlelist.h"

void medicine_menu()//主菜单
{
   
    
    printf("\t----- Hello! You have entered the management system of pharmacy -----\n\n");
    printf("\t\t\t\t\t\t\t\t\tMENU\n\n");
    printf("\t\t\t    Enter 1 to add the message of medicine.\n");//添加
    printf("\t\t\t    Enter 2 to check the message of medicine.\n");//查看
    printf("\t\t\t    Enter 3 to revise the message of medicine.\n");//修改
    printf("\t\t\t    Enter 4 to search medicine with its number.\n");//按编号查找
    printf("\t\t\t    Enter 5 to sort medicine by price.\n");//按价格排序
    printf("\t\t\t    Enter 6 to delete the message of medicine.\n");//删除信息
    printf("\t\t\t    Enter 7 to exit this system.\n");//退出
    printf("\t---------------------------------------------------------------------\n\n");
    printf("\t\t\t    Please enter the number (1 ~ 7) :");
    
}
drug *list;
void input()//用户输入
{
   
    int choice = 0;
    medicine date;
    drug *pMove = NULL;
    scanf("%d",&choice);
    switch(choice)
        {
   
            case 1://添加信息
                printf("\t\t\t\t\t----------[ADD MESSAGES]----------\n");
                printf("\t\tPlease enter the number,name,MFD,EXP,price,inventory,brand and function\n");
                printf("\t\t");
                fflush(stdin);
                scanf("%s %s %s %s %lf %s %s %s",
                      date.number,date.name,date.MFD,date.EXP,&date.price,date.inventory,date.brand,date.function);
                insert(list, date);
                break;
            case 2://查看所有信息
                printf("\t\t\t\t\t----------[Check Information]----------\n");
                print(list);
                break;
            case 3://修改信息
                printf("\t\t\t\t\t----------[Revise Information]----------\n");
                printf("\t\tPlease enter the number needed to be revised:");
                scanf("%s",date.number);
                if(search(list, date.number) == NULL)
                {
   
                    printf("Erro\n");
                }
                else
                {
   
                    drug *node = search(list, date.number)<
  • 7
    点赞
  • 55
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值