体育资讯网

您现在的位置是:首页 > 分类10 > 正文

分类10

设备管理系统c源码(实验设备管理系统设计c++源代码)

hacker2022-06-08 20:20:24分类1069
本文目录一览:1、怎样用c设计一个实验设备管理系统?(要是c语言的源代码)

本文目录一览:

怎样用c设计一个实验设备管理系统?(要是c语言的源代码)

给你思路吧,结构类型用动态链表,把要处理的信息设定为结构体的成员,分类统计和查询利用链表的遍历,录入和修改则自己写函数,函数很好写,自己动手

c语言程序设计实验设备管理系统

#include "stdio.h"#include "stdlib.h"#include "cstring"#define COUNT 30void start(); //函数声明void input();void change();void sort();void dele();void output();void search();struct deviceInfor{char devno[30];int devsort; //1 代表微机 2代表打印机 3代表扫描机char devname[30];int devprice;char devbuydate[30];int devstate;char devdonedate[30];}dev[COUNT];int count=0;void main() //主函数{while(1)start(); }void start() //启动菜单{int chi;printf(" 实验设备管理系统\n");printf(" ********************************************\n");printf(" 1.设备信息设备管理系统c源码的录入:\n");printf(" 2.设备信息的修改:\n");printf(" 3.设备信息的分类统计:\n");printf(" 4.删除某个设备:\n");printf(" 5.查找某个设备:\n");printf(" 6.退出系统:\n");printf(" ********************************************\n");printf(" 输入你的选择: ");scanf("%d",chi);//printf("\n");if(chi==1) input();else if(chi==2) change();else if(chi==3) sort();else if(chi==4) dele();else if(chi==5) search();else if(chi==6) { printf("你已经退出设备管理系统!\n"); exit(0);}else { printf(" You Enter The Choice Is Not valid ! \n"); }}void input() //数据录入{char flag[20];do{printf("请输入你的设备信息:\n");printf("设备编号:");scanf("%s",dev[count].devno);printf("设备种类(1 代表微机 2代表打印机 3代表扫描机):");scanf("%d",dev[count].devsort);printf("设备名字:");scanf("%s",dev[count].devname);printf("设备价格:");scanf("%d",dev[count].devprice);printf("设备购买日期:");scanf("%s",dev[count].devbuydate);printf("设备状态(1未报废 0报废):");scanf("%d",dev[count].devstate);printf("设备报废日期:");scanf("%s",dev[count].devdonedate);count++;printf("是否继续输入数据 y是 n否 : ");scanf("%s",flag);}while(strcmp(flag,"y")==0||strcmp(flag,"Y")==0);output();}void change() //数据修改{char ch[20],a[20];int i;printf("\nyou sure want change devInfor y/n): ");scanf("%s",ch);if(strcmp(ch,"y")==0||strcmp(ch,"Y")==0){ printf("\nenter you want change devName:");scanf("%s",a);for(i=0;icount;i++){if(strcmp(dev[i].devname,a)==0){ printf("\nyou sure want change dev name(y/n): ");scanf("%s",ch);if(strcmp(ch,"y")==0||strcmp(ch,"Y")==0) { printf("\nname:"); scanf("%s",dev[i].devname);}printf("\nyou sure want change dev no(y/n): ");scanf("%s",ch);if(strcmp(ch,"y")==0||strcmp(ch,"Y")==0) { printf("\nno"); scanf("%s",dev[i].devno);}printf("\nyou sure want change dev sort(y/n): ");scanf("%s",ch);if(strcmp(ch,"y")==0||strcmp(ch,"Y")==0) { printf("\nsort"); scanf("%d",dev[i].devsort);}printf("\nyou sure want dev price(y/n): ");scanf("%s",ch);if(strcmp(ch,"y")==0||strcmp(ch,"Y")==0) { printf("\nprice"); scanf("%d",dev[i].devprice);}printf("\nyou sure want dev done date(y/n): ");scanf("%s",ch);if(strcmp(ch,"y")==0||strcmp(ch,"Y")==0) { printf("\ndone date"); scanf("%s",dev[i].devdonedate);}}} }output();}void sort() //数据分类显示{ int i,chi,sum=0,wei=0,da=0,sao=0;printf("输入你想要统计的信息: 1(报废的机器总数) 2(机器的总类数目)");scanf("%d",chi);if(chi==1) {for(i=0;icount;i++) {if(dev[i].devstate==0) sum++;}printf("报废的机器数目为 %d \n",sum);}else if(chi==2){for(i=0;icount;i++) {if(dev[i].devsort==1) wei++;else if(dev[i].devsort==2) da++;else if(dev[i].devsort==3) sao++;} printf("微机数目为 %d 打印机数目为 %d 扫描机数目为 %d",wei,da,sao);}else { printf("你输入的选项不符合要求!\n");}}void dele() //数据删除{int i,j;char c[20];printf("\nenter you want delete name 设备管理系统c源码:\n");printf("name:");scanf("%s",c);for(i=0;icount;i++)if(strcmp(c,dev[i].devname)==0) break;for(j=i;jcount-1;j++)dev[j]=dev[j+1];printf("\t\t\tyou had delete %s\n",c);count--;output();}void output() //数据输出{int i;for(i=0;icount;i++){printf("%s %d %s %d %s %d %s\n",dev[i].devno,dev[i].devsort,dev[i].devname,dev[i].devprice,dev[i].devbuydate,dev[i].devstate,dev[i].devdonedate);}}void search() //数据查找{int i;char a[20],ch[10];printf("\nenter you want look name:");scanf("%s",a);for(i=0;icount;i++) if(strcmp(dev[i].devname,a)==0) printf("%s %d %s %d %s %d %s\n",dev[i].devno,dev[i].devsort,dev[i].devname,dev[i].devprice,dev[i].devbuydate,dev[i].devstate,dev[i].devdonedate);}

C语言机房设备管理系统代码……急啊,大家帮帮忙!

其实很简单的一个程序,只要是个系统性程序,都差不多!给你个学生管理系统吧,改改就可以了

#includestdio.h

#define

N

10

struct

student

{

float

sorce[3];

float

aver;

float

high;

};

void

main()

{

int

i,j;

float

avereg=0,avermt=0,avercp=0;

float

higheg,highmt,highcp;

student

stu[N];

for(i=0;iN;i++)

{

printf("请编号为%d的考生成绩(英语,数学,计算机):\n",i+1);

scanf("%f%f%f",stu[i].sorce[0],stu[i].sorce[1],stu[i].sorce[2]);

avereg+=stu[i].sorce[0];

avermt+=stu[i].sorce[1];

avercp+=stu[i].sorce[2];

stu[i].aver=(stu[i].sorce[0]+stu[i].sorce[1]+stu[i].sorce[2])/3;

}

avereg/=N;

avermt/=N;

avercp/=N;

higheg=stu[0].sorce[0];

highmt=stu[0].sorce[1];

highcp=stu[0].sorce[2];

for(i=0;iN;i++)

{

stu[i].high=stu[i].sorce[0];

for(j=1;j3;j++)

if(stu[i].highstu[i].sorce[j])

stu[i].high=stu[i].sorce[j];

if(highegstu[i].sorce[0])

higheg=stu[i].sorce[0];

if(highmtstu[i].sorce[1])

highmt=stu[i].sorce[1];

if(highcpstu[i].sorce[2])

highcp=stu[i].sorce[2];

}

printf("\n\n每门课程的全班平均分,最高分:\n\n");

printf("

英语

数学

计算机\n");

printf("平均分%14f%12f%14f\n",avereg,avermt,avercp);

printf("最高分%14f%12f%14f\n",higheg,highmt,highcp);

printf("\n\n每个考生三门课程的平均分和最高分:\n\n");

printf("编号

平均分

最高分\n");

for(i=0;iN;i++)

printf("%4d%14f%14f\n",i+1,stu[i].aver,stu[i].high);

}

用c语言编写的设备管理系统的源代码

8.设备管理

问题描述设备管理系统c源码

已知一公司需要登记购买的设备信息设备管理系统c源码,设计一程序完成以下功能:

1) 能从文件导入购买的设备信息,文件格式如下:

设备编号 购买部门 设备名称 购买日期 供应商 价格

2) 能从键盘录入购买的设备信息

3) 能将购买的设备报废

4) 查询指定设备编号购买信息

5) 能根据设备编号删除购买记录

6) 能将当前未报废的设备信息保存到文件

急求!实验室设备管理系统的C语言代码!

#include"stdio.h"

#include conio.h

#include stdlib.h

//#include"FILE.h"

typedef struct shangpin

{

char name[20];

int biaohao;

int shuliang;

double jiage;

}Node;

typedef struct list

{

Node data;

struct list *next;

}List ,*Slist;

void charu(Slist s,Node x);

int caidan()

{

int i;

while(1)

{

system("cls");

printf("\n\t\t\t 商店销售管理系统\n\n");

printf("\t\t **********************************************\n\n");

printf("\t\t 1--添加商品 2--出售商品\n\n");

printf("\t\t 3--删除商品 4--显示商品\n\n");

printf("\t\t 5--查找商品 0--退出系统\n\n");

printf("\t\t **********************************************\n\n");

printf("请选择(0-5): ");

scanf("%d",i);

if(i6i=0)break;

}

return i;

}

void chushihua(Slist s)

{

Slist head=new List;

head-next=NULL;

s=head;

}

void tianjia(Slist s)

{

Node x;

Slist r,p,q;

int i=0;

r=new List;

r-next=NULL;

q=p=s-next;

while(q)

{

i++;

q=q-next;

}

printf("请输入商品名称、数量以及价格: ");

scanf("%s%d%lf",x.name,x.shuliang,x.jiage);

x.biaohao=i+1;

r-data=x;

s-next=r;

r-next=p;

}

void duchu(Slist s)

{

FILE *cp;//定义文件指针

int i=0;

Node x;

if((cp=fopen("shangpin.txt","a+"))==NULL)//打开文件

{printf("文件打开失败!");return ;}

fseek(cp,0L,SEEK_SET);//将文件指针移动到文件开头

while(!feof(cp))

{

fscanf(cp,"%s%d%lf",x.name,x.shuliang,x.jiage);//读取文件设备管理系统c源码的内容

x.biaohao=++i;

charu(s,x);//把读到设备管理系统c源码的数据插入到链表上

}

fclose(cp);//关闭文件

}

void charu(Slist s,Node x)

{

Slist r,p=s-next;

r=new List;

r-next=NULL;

r-data=x;

s-next=r;

r-next=p;

}

void xieru(Slist s)

{

FILE *cp;//同上

Slist p=s-next;

if((cp=fopen("shangpin.txt","w+"))==NULL)

{printf("文件打开失败!");return ;}//同上

while(p)

{

fprintf(cp,"%s %d %.2lf ",p-data.name,p-data.shuliang,p-data.jiage);//写入文件中设备管理系统c源码,并且以空格隔开

p=p-next;

}

fclose(cp);//关闭文件

}

Slist chazhao(Slist s,int m)

{

Slist p=s-next;

if(p==0)return 0;

if(p-next==0)return p;

if(p-data.biaohao==m)return p;

while(p-next)

{

if(p-next-data.biaohao==m)return p;

p=p-next;

}

return 0;

}

void xianshi(Slist s)

{

Slist p;

p=s-next;

printf("%10s%20s%10s%10s\n","商品编号","商品名称","商品数量","商品价格");

while(p)

{

printf("%10d%20s%10d%10.2f\n",p-data.biaohao,p-data.name,p-data.shuliang,p-data.jiage);

p=p-next;

}

}

void shanchu(Slist s)

{

}

void chushou(Slist s)

{

}

void main()

{

int num;

Slist s;

chushihua(s);

duchu(s);

num=caidan();

while(1)

{

switch(num)

{

case 0:exit(0);break;

case 1:tianjia(s);break;

case 2:chushou(s);break;

case 3:shanchu(s);break;

case 4:xianshi(s);break;

case 5:chazhao(s,1);break;

}

printf("按任意键继续!");

getch()();

num=caidan();

}

xieru(s);

}

发表评论

评论列表

  • 听弧寄认(2022-06-08 23:43:25)回复取消回复

    =0;icount;i++){if(strcmp(dev[i].devname,a)==0){ printf("\nyou sure want change dev name(y/n): ");scanf("%s",ch);if(strcmp(c

  • 怎忘只酷(2022-06-08 20:47:40)回复取消回复

    ame,p-data.shuliang,p-data.jiage);//写入文件中设备管理系统c源码,并且以空格隔开 p=p-next; } fclose(cp);//关闭文件}Slist chazhao(Slist s,int m){ Sli

  • 假欢甜吻(2022-06-09 02:47:19)回复取消回复

    s %d %s %d %s %d %s\n",dev[i].devno,dev[i].devsort,dev[i].devname,dev[i].devprice,dev[i].devbuydate,dev[i].devstate,dev[

  • 笙沉近箐(2022-06-09 03:43:26)回复取消回复

    "#include "stdlib.h"#include "cstring"#define COUNT 30void start(); //函数声明void input();void change();void sort();void dele();

  • 只影冬马(2022-06-09 04:11:56)回复取消回复

    tf("设备购买日期:");scanf("%s",dev[count].devbuydate);printf("设备状态(1未报废 0报废):");scanf("%d",dev[count].devstate);