商品管理系统

可以直接运行

#include<graphics.h>
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
#define NULL 0
#define LEN sizeof(struct equipment)

struct equipment
{long number;
char name[20];
char adr[20];
long date;
long taishu;
long price;
long amount;
char instruction[20];
struct equipment *next;
};
struct equipment *head,*equip,*p5,*p;
int n;
struct equipment *del1,*del2,*del3;
struct equipment*insert(struct equipment *head,struct equipment *p);

/*输入函数*/
struct equipment* creat(void)
{struct equipment *p1,*p2;
n=0;
p1=p2=(struct equipment*)malloc(LEN);
printf("\n教学设备编号为0时,退出输入!\n");
printf("输入教学设备编号 :");
scanf("%ld",&p1->number);
printf("\n输入设备名称:");
scanf("%s",&p1->name);
printf("\n输入生产厂家:");
scanf("%s",&p1->adr);
printf("\n输入购置日期:");
scanf("%ld",&p1->date);
printf("\n输入台数:");
scanf("%ld",&p1->taishu);
printf("\n输入单价:");
scanf("%ld",&p1->price);
p1->amount=(p1->taishu)*(p1->price);
printf("\n输入备注:");
scanf("%s",&p1->instruction);
head=NULL;
while(p1->number!=0)
{n=n+1;
if(n==1) head=p1;
else p2->next=p1;
p2=p1;
p1=(struct equipment*)malloc(LEN);
printf("\n输入教学设备编号:");
scanf("%ld",&p1->number);
if(p1->number==0) break;
else
{printf("\n输入设备名称:");
scanf("%s",&p1->name);
printf("\n输入生产厂家:");
scanf("%s",&p1->adr);
printf("\n输入购置日期:");
scanf("%ld",&p1->date);
printf("\n输入台数:");
scanf("%ld",&p1->taishu);
printf("\n输入单价:");
scanf("%ld", &p1->price);
p1->amount=(p1->taishu)*(p1->price);
printf("\n输入备注:");
scanf("%s",p1->instruction);}
}
p2->next=NULL;
return(head);
}
void print()
{clrscr();
gotoxy(33,0);
printf("\16[{-80|10@30,30=4(2)5****中南大学教学设备管理系统****}]");
gotoxy(3,5);
printf("设备编号 设备名称 生产厂家 购置日期 台数 单价 金额 备注\n");}
void print1()
{int i,j;
for(i=0;i<=8;i++)
line(70*i+16,60,70*i+16,60+36*(n+1));
for(j=0;j<=n+1;j++)
line(16,60+36*j,70*8+16,60+36*j);}

/*显示函数*/
void output(struct equipment* head)
{struct equipment*p;
p=head;
printf(" ");
if(head!=NULL)
do
{printf("\n %-9ld%-9s%-9s%-9ld%-9ld%-9ld%-9ld%-9s \n",p->number,p->name,p->adr,p->date,p->taishu,p->price,p->amount,p->instruction);
p=p->next;}while(p!=NULL);
printf(" ");
getch();}
/*修改函数*/
void change(struct equipment* head)
{struct equipment *p;
long num;
cleardevice();
for(;;)
{
printf("\n请输入要修改的设备编号:");
scanf("%ld",&num);
p=head;
while(num!=p->number&&p->next!=NULL)
{p=p->next;}
if(num!=p->number)
{printf("\n对不起,无此记录!按任意键返回!");
getch();
bre


ak;}
else
{printf("\n请输入新的设备记录:");
printf("\n输入教学设备编号:");
scanf("%ld",&p->number);
printf("\n输入教学

你可能喜欢

  • 商品库存管理
  • 商品信息管理系统
  • 超市商品管理系统
  • 商品销售管理系统
  • 商品进销存管理系统

商品管理系统相关文档

最新文档

返回顶部