毕业论文论文范文课程设计实践报告法律论文英语论文教学论文医学论文农学论文艺术论文行政论文管理论文计算机安全
您现在的位置: 毕业论文 >> 课程设计 >> 正文

实验设备管理系统

更新时间:2007-10-22:  来源:毕业论文
实验设备管理系统|c语言程序代码编程小程序设计|c语言课程设计报告课程案例

#include <stdio.h>
#include <string.h>

struct instrument
{
char p_num[12];
char name[12];
char spec[12];
int amount;
int price;
int s_price;
struct instrument *next;
};
struct instrument *head;

struct in_instrument
{
char num[12];
char p_num[12];
char name[12];
int amount;
int price;
int t_price;
struct in_instrument *next;
};
struct in_instrument *ihead;

struct out_instrument
{
char num[12];
char p_num[12];
char name[12];
int amount;
int price;
int t_price;
struct out_instrument *next;
};
struct out_instrument *ohead;

struct quit_instrument
{
char num[12];
char p_num[12];
char name[12];
int amount;
int price;
int t_price;
struct quit_instrument *next;
};
struct quit_instrument *qhead;

int init()
{
head=ihead=ohead=qhead=NULL;
printf("0: Quit\n");
printf("1: Enter the information of in instrument\n");
printf("2: Enter the information of out instrument\n");
printf("3: Enter the information of quit instrument\n");
printf("4: Total the information of instrument\n");
}

int menu()
{
printf("1:insert data\n");
printf("2:delete data\n");
printf("3:modify data\n");
printf("4:select data\n");
printf("Other to quit\n");
}

int menu2()
{
printf("0: Quit\n");
printf("1: Enter the information of in instrument\n");
printf("2: Enter the information of out instrument\n");
printf("3: Enter the information of quit instrument\n");
printf("4: Total the information of instrument\n");
}

int insert_instrument()
{
struct instrument * p1,* p;
p1=(struct instrument *)malloc(sizeof(struct instrument));
p=head;
if (p==NULL)/*开始没有数据*/
{
printf("Enter the data of instrument\n");
printf("Include the spbh,name,style,num,price,sale_price of instrument\n");
scanf("%s%s%s%d%d%d",
&p1->p_num,&p1->name,&p1->spec,&p1->amount,&p1->price,&p1->s_price);
head=p1;
head->next=NULL;
return 0;
}
while(p->next!=NULL)/*把指针移到链表末端,在链表末端插入数据*/
p=p->next;
p->next=p1;
printf("Enter the data\n");
scanf("%s%s%s%d%d%d",
&p1->num,&p1->p_num,&p1->name,&p1->amount,&p1->price,&p1->t_price);
p1->next=NULL;
}
int in_insert()
{
struct in_instrument * p1,* p;
p1=(struct in_instrument *)malloc(sizeof(struct in_instrument));
p=ihead;
if (p==NULL)/*开始没有数据*/
{
printf("Enter the data of in instrument\n");
printf("Include the rkbh,spbh,name,number,price,total_price\n");
scanf("%s%s%s%d%d%d",
&p1->num,&p1->p_num,&p1->name,&p1->amount,&p1->price,&p1->t_price);
ihead=p1;
ihead->next=NULL;
return 0;
}
while(p->next!=NULL)/*把指针移到链表末端,在链表末端插入数据*/
p=p->next;
p->next=p1;
printf("Enter the data\n");
scanf("%s%s%s%d%d%d",
&p1->num,&p1->p_num,&p1->name,&p1->amount,&p1->price,&p1->t_price);
p1->next=NULL;
}

int in_modify()
{
char m_num[12];
struct in_instrument * p;
p=ihead;
printf("Enter the modify num\n");
scanf("%s",&m_num);
if (p==NULL)/*开始没有数据*/
{
printf("Sorry! No data can be found\n");
return 0;
}
while(p!=NULL)
{
if (strcmp(p->num,m_num)==0)
{
printf("Enter the new data without num\n");
scanf("%s%s%d%d%d",
&p->p_num,&p->name,&p->amount,&p->price,&p->t_price);
printf("One data had modified\n");
return 0;
}
p=p->next;
}
printf("Sorry! No num has found\n");
}

int in_select()
{
char s_num[12];
struct in_instrument * p;
p=ihead;
printf("Enter the select num\n");
scanf("%s",&s_num);
while(p!=NULL)
{
if (strcmp(p->num,s_num)==0)
{
printf("The data you want is:\n");
printf(" %s %s %s %d %d %d\n",
p->num,p->p_num,p->name,p->amount,p->price,p->t_price);
return 0;
}
p=p->next;
}
printf("Sorry! No num has found\n");
}

[1] [2] 下一页

实验设备管理系统下载如图片无法显示或论文不完整,请联系qq752018766
设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©youerw.com 优文论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。