当前位置:首页 » 编程语言 » c语言课程设计实验设备
扩展阅读
webinf下怎么引入js 2023-08-31 21:54:13
堡垒机怎么打开web 2023-08-31 21:54:11

c语言课程设计实验设备

发布时间: 2023-08-11 23:04:08

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

下面的是我前几天刚针对这题目做的做的:
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
struct shebei
{
char ID[10];
char name[15];
char kind[15];
char over[15];
char yesno[10];
char time[10];
char price[10];
};
typedef struct node
{
struct shebei data;
struct node *next; //建立一个链表。
}Node;
void Add(Node *equip) //添加记录
{
Node *p,*r,*s;
char id[10]; //先用于输入ID,也用于判断是否跳出循环
r=equip;
s=equip->next; //使s为第一个有用的结点
while(r->next!=NULL) //这个循环的作用是使r为最后一个有用的结点
r=r->next; //将指针置于最末尾
while(1)
{
printf(">>>>>>>>>>提示:输入0则返回主菜单!\n");
printf("\n请你输入设备ID号:");
scanf("%s",id);
if(strcmp(id,"0")==0) break;
p=(Node *)malloc(sizeof(Node)); //申请空间
strcpy(p->data.ID,id);
printf("\n请输入设备名称:");
scanf("%s",p->data.name);
printf("\n请输入设备种类:");
scanf("%s",p->data.kind);
printf("\n请输入报废日期:");
scanf("%s",&p->data.over);
printf("\n请输入设备是否报废:");
scanf("%s",&p->data.yesno);
printf("\n请输入设备购买时间:");
scanf("%s",&p->data.time);
printf("\n请输入设备价格:");
scanf("%s",&p->data.price);
printf(">>>>>>>>>>提示:已经完成一条记录的添加。\n");
p->next=NULL;
r->next=p; //这一步是必需的,将p与先前的链表连起来构成一条新链表
r=p; //也是必需的.将r 又重设为新链的最后一个有用结点
}
}
void Modify(Node *equip)//修改
{
Node *p;
char find[20];
if(!equip->next)
{
printf("\n>>>>>>>>>>提示:没有资料可以修改!\n");
return;
}
printf("请输入要修改的设备ID号:");
scanf("%s",find);
p=equip->next;
while(p!=NULL)
{
if(strcmp(p->data.ID,find)==0) //如果找到的话返回的是符合要求
break;
p=p->next;
}
if(p) //若找到
{
int x;
while(1)
{
printf("完成修改请输入0否则输入任意数再进行修改:");
scanf("%d",&x);
if(x==0)
{break;}
printf("请输入新设备号(原来是 %s ):",p->data.ID);
scanf("%s",p->data.ID);
printf("请输入新设备名称(原来是 %s ):",p->data.name);
scanf("%s",p->data.name);
printf("请输入新设备设备种类名称(原来是 %s ):",p->data.kind);
scanf("%s",p->data.kind);
printf("请输入新设备报废日期名称(原来是 %s ):",p->data.over);
scanf("%s",p->data.over);
printf("请输入新设备是否报废(原来是 %s ):",p->data.yesno);
scanf("%s",p->data.yesno);
printf("请输入新设备购买时间(原来是 %s ):",p->data.kind);
scanf("%s",p->data.time);
printf("请输入新设备价格(原来是 %s ):",p->data.price);
scanf("%s",p->data.price);
printf("\n>>>>>>>>>>提示:该项记录资料已经成功修改!\n");
}
}
else printf("\n>>>>>>>>>>提示:你要修改的信息不存在!\n");
}
void Disp(Node *equip)//输出记录
{
Node *p;
p=equip->next;
if(!p)
{
printf("\n>>>>>>>>>>提示:没有记录可以显示!\n");
return;
}
printf("\t\t\t\t显示结果\n");
printf("设备号 设备名称 设备种类 报废日期 是否报废 购买时间 价格\n");
while(p)
{
printf("\n%-13s%-11s%-7s%-10s%-13s%-10s%-5s\n",p->data.ID,p->data.name,p->data.kind,p->data.over,p->data.yesno,p->data.time,p->data.price);
p=p->next;
}
}
void Tongji(Node *equip)//统计
{
Node *p;
int sel;int flag2=0,ha=0;
p=equip->next;
char find[20];
if(!equip->next) //若链表为空
{
printf("\n>>>>>>>>>>提示:没有资料可以统计分类!\n");
return;
}
printf(">>>>>>>>>>提示:\n=====>0退出\n=====>1按设备号统计\n=====>2按设备名称统计\n");
scanf("%d",&sel);
if(sel==1)
{
printf("\n输入你要统计分类的设备号:");
scanf("%s",find);
while(p)
{
if(strcmp(p->data.ID,find)==0)
{
flag2++;
}
if(flag2==1&&ha!=flag2)
{ printf("设备号 设备名称 设备种类 报废日期 是否报废 购买时间 价格\n");
printf("\n%-13s%-11s%-7s%-10s%-13s%-10s%-5s\n",p->data.ID,p->data.name,p->data.kind,p->data.over,p->data.yesno,p->data.time,p->data.price);
ha=flag2;
}
else if(flag2>ha){printf("\n%-13s%-11s%-7s%-10s%-13s%-10s%-5s\n",p->data.ID,p->data.name,p->data.kind,p->data.over,p->data.yesno,p->data.time,p->data.price);ha=flag2;}
p=p->next;
}
if(flag2)
{
printf("\n*************************按设备号%s统计分类的有%d条记录:*************************\n\n",find,flag2);
}
else {printf("\n按设备号%s统计的结果为0个\n\n",find);}
}
else if(sel==2)
{
printf("\n输入你要统计分类的设备名称:");
scanf("%s",find);
while(p)
{
if(strcmp(p->data.name,find)==0)
{
flag2++;
}
if(flag2==1&&ha!=flag2)
{ printf("设备号 设备名称 设备种类 报废日期 是否报废 购买时间 价格\n");
printf("\n%-13s%-11s%-7s%-10s%-13s%-10s%-5s\n",p->data.ID,p->data.name,p->data.kind,p->data.over,p->data.yesno,p->data.time,p->data.price);
ha=flag2;
}
else if(flag2>ha){printf("\n%-13s%-11s%-7s%-10s%-13s%-10s%-5s\n",p->data.ID,p->data.name,p->data.kind,p->data.over,p->data.yesno,p->data.time,p->data.price);ha=flag2;}
p=p->next;
}
if(flag2)
{
printf("\n******************按设备名称%s统计的有%d条记录:********************\n\n",find,flag2);
}
else {printf("\n按设备名称%s统计分类的结果为0个\n\n",find);}
}
else if(sel==0) return;
}
void main()
{
Node *equip;
FILE *fp;
int flag;
Node *p,*q;
printf("\t\t\t\t设备管理系统\n");
equip=(Node*)malloc(sizeof(Node));
equip->next=NULL;
p=equip;
fp=fopen("设备管理系统","wb+");
q=(Node*)malloc(sizeof(Node));
if(fread(q,sizeof(Node),1,fp)) //将文件的内容放入接点中
{
q->next=NULL;
p->next=q;
p=q; //将该接点挂入链表中
}
fclose(fp); //关闭文件
while(1)
{
printf("**************************************目录**************************************");
printf("\n1添加记录\n");
printf("\n2修改记录\n");
printf("\n3显示记录\n");
printf("\n4统计分类记录\n");
printf("\n0*-EXIT-*\n");
printf("请输入你要操作的序号:");
scanf("%d",&flag);
switch(flag)
{
case 0: printf("\n>>>>>>>>>>提示:已经退出系统,ByeBye!\n");break;
case 1: Add(equip); break; //增加记录
case 2: Modify(equip); break;//修改记录
case 3: Disp(equip); break;//显示记录信息
case 4: Tongji(equip); break;//统计记录
default: printf("\n>>>>>>>>>>提示:输入错误!\n"); break;
}
}
}

Ⅱ 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.设备信息的录入:\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;i<count;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;i<count;i++) {if(dev[i].devstate==0) sum++;}printf("报废的机器数目为 %d \n",sum);}else if(chi==2){for(i=0;i<count;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 :\n");printf("name:");scanf("%s",c);for(i=0;i<count;i++)if(strcmp(c,dev[i].devname)==0) break;for(j=i;j<count-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;i<count;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;i<count;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语言课题设计——实验室设备管理系统 实现功能:(1)设备信息:设备编号、设备名称、设备地点(实

#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(i<6&&i>=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 chu(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);//读取文件的内容
x.biaohao=++i;
charu(s,x);//把读到的数据插入到链表上
}
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);//写入文件中,并且以空格隔开
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);
chu(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);
}

这是我以前给别人的一个商品管理的,用文件存储,用的由头结点的链表存储数据的(不理解可以不管),你是拿这个自己改改不会问我呢?还是我直接给你改了?
以上回答你满意么?

Ⅳ 通过该实验把C语言中的几个主要知识(如:顺序结构、选择结构、循环结构、数组、函数等)得到综合应用。

#include <stdio.h>
#include <math.h>
#include <String.h>
#include <Bios.h>
#define ESC 27
#define ENTER 20
#define YES 'Y'
#define NO 'N'

/*********全局变量区********/
int volatile key=0,low=0; //用于键盘识别
char volatile search_name[5],search_flag=0; //用于寻找字符串
char volatile R=0,All=0,Error=0; //用于识别是否计算线路电阻,All用于识别是否一次计算完所有的短路点,寻找错误次数
char volatile Short[2]={0}; //用于记录电路点名称,如K1
char volatile Line_flag=0; //寻找线路位置标志
char volatile table1[20]={0}; //用于记录串联的位置数
char volatile table2[20]={0}; //用于记录并联的位置数
char volatile record[2]={0} ; //用于记录短路点的元件存储号
char volatile found=0; //记录已经找到的串联,为下一个首端做标记
float volatile Kim[5]={0}; //冲击电流系数
char volatile kim1=0; //用于冲击电流系数数组
float volatile VH=121; //变压器高压侧平均电压
struct para //结构体数组,用于存储元件参数
{char Class; // 元件类型,0-表示线路,1表示电源,2表示电抗,3表示变压器
char name[5]; // 元件所在名称
float paras[4]; // 元件参数
};
/**************************/

/*******函数声明********/
char Data_process(void);
char input(char number1,char number2,struct para *data,char type);
void Data_Dir(char num1,char num2,struct para *temp,char type2);
float find_short(char *pp,unsigned int sum,char dir0,struct para *data1);
void Line_ID(char *string1,char *string2,char dir);
char find_fun(char sum2,char dir2,char or,char head[] ,struct para *data);
/**********************/

/*函数:input(数目,参数,类型)
功能;完成电力系统元件参数的输入
返回:是否修改值
问题:结构体不能应用浮点型数据!!输入输出出错,原来是编译器的问题!!改变内核即可
*/
char input(char number1,char number2,struct para *data,char type)
{char i=0,answer=0;
switch(type)
{case 0: //第一次输入线路参数
{ for(i=number1;i<number2;i++)
{ data[i].Class=0;
scanf("%f,%f,%f,%f,%s",&data[i].paras[0],&data[i].paras[1],&data[i].paras[2],&data[i].paras[3],data[i].name);
printf("\n");
}
if(number1!=number2)
{ printf("The Line parameters are:\n");
printf("[Name Class Legth Rate, Res,Un(KV)]\n ");
for(i=number1;i<number2;i++)
{printf("%s,%4d,%9.2f,%6.2f,%3.2f,%6.2f\n",data[i].name,data[i].Class,data[i].paras[0],data[i].paras[1],data[i].paras[2],data[i].paras[3]);
printf(" ");
}
}
} break;
case 1: //输入电源参数
{for(i=number1;i<number2;i++)
{ data[i].Class=1;
scanf("%f,%f,%f,%f,%s",&data[i].paras[0],&data[i].paras[1],&data[i].paras[2],&data[i].paras[3],data[i].name);
printf("\n");
}
if(number1!=number2)
{ printf("\nThe Power parameters are:\n");
printf("[Name Class Capability Xd' E'' Style]\n ");
for(i=number1;i<number2;i++)
{printf("%s,%4d,%8.2f,%6.2f,%7.2f\n",data[i].name,data[i].Class,data[i].paras[0],data[i].paras[1],data[i].paras[2],data[i].paras[3]);
printf(" ");
}
}
} break;
case 2: //输入电抗器参数
{ for(i=number1;i<number2;i++)
{data[i].Class=2;
scanf("%f,%f,%f,%f,%s",&data[i].paras[0],&data[i].paras[1],&data[i].paras[2],&data[i].paras[3],data[i].name);
printf("\n");
}
if(number1!=number2)
{ printf("\nThe Reactance parameters are:\n");
printf("[Name Class VR(KV) IR(KA) XR Un(KV)]\n ");//(名称,位置,额定电压,额定电流,所在平均电压)
for(i=number1;i<number2;i++)
{printf("%s,%2d,%10.2f,%6.2f,%6.2f,%6.2f\n",data[i].name,data[i].Class,data[i].paras[0],data[i].paras[1],data[i].paras[2],data[i].paras[3]);
printf(" ");
}
}
} break;
case 3: //第一次输入变压器参数
{ for(i=number1;i<number2;i++)
{data[i].Class=3;
scanf("%f,%f,%f,%f,%s",&data[i].paras[0],&data[i].paras[1],&data[i].paras[2],&data[i].paras[3],data[i].name);
printf("\n");
}
if(number1!=number2)
{ printf("\nThe Transformer parameters are:\n");
printf("[Name Class Capability UH(KV) UL(KV) Uk(%)]\n ");
for(i=number1;i<number2;i++)
{printf("%s,%2d,%12.2f,%8.2f,%8.2f,%6.2f\n",data[i].name,data[i].Class,data[i].paras[0],data[i].paras[1],data[i].paras[2],data[i].paras[3]);
printf(" ");
}
}
answer=1; //完成元件的输入
} break;
default:break;
}

printf("\nDo you sure all the parameters are right?\n");
AAA: printf("\nEnter (Y) to continue,(N) to modify,(ESC) to exit.\n");
while(bioskey(1)==0); /*检测键盘是否有击健*/
key=bioskey(0); /*读取键盘输入的扫描码*/
low=key & 0x00ff; /*提取低8位*/
if(low==NO)
{answer=0;
printf("\nPlease input the name of the data\n");
FIND:
scanf("%s",search_name);
for(i=number1;i<number2;i++) /*寻找需要修改的线路*/
{if(strcmp(search_name,data[i].name)==0)
{search_flag=i;break;} /*找到就强制跳出循环*/
else
{search_flag=127;}
}
if(search_flag==127) /*没有找到*/
{printf("\nInput Error! Please Check and Input again!\n");
printf("Warning:you have only ten times chances!\n");
Error++;
if(Error>10) //10次出错
{ printf("\nTimes up! Enter anykey to exit!\n");
while(bioskey(1)==0); /*检测键盘是否有击健*/
exit(0);
Error=0;
}
else
{goto FIND;} /*继续回去寻找*/
}

printf("Please input the new paras of the data\n");
switch(type) //修改时输入的参数
{ case 0:{ printf("Format(Leghth(Km),Rate(@/Km),Res,Un(KV), Name)\n");

scanf("%f,%f,%f,%f,%s",&data[search_flag].paras[0],&data[search_flag].paras[1],&data[search_flag].paras[2],&data[search_flag].paras[3],data[search_flag].name);
printf("\n");

}break;
case 1:{ printf("Format(Capability(MVA),Xd',E'',Style,Name)\n");

scanf("%f,%f,%f,%f,%s",&data[search_flag].paras[0],&data[search_flag].paras[1],&data[search_flag].paras[2],&data[search_flag].paras[3],data[search_flag].name);
printf("\n");

}break;
case 2:{ printf("Format(UR(KV),IR(kA),XR(%),Un(KV),Name)\n");

scanf("%f,%f,%f,%f,%s",&data[search_flag].paras[0],&data[search_flag].paras[1],&data[search_flag].paras[2],&data[search_flag].paras[3],data[search_flag].name);
printf("\n");

}break;
case 3:{ printf("Format(Capability UH(KV),UL(KV), Uk(%),Name)\n");

scanf("%f,%f,%f,%f,%s",&data[search_flag].paras[0],&data[search_flag].paras[1],&data[search_flag].paras[2],&data[search_flag].paras[3],data[search_flag].name);
printf("\n");

}break;
default:break;
}

printf("\nThe new parameters are:\n");
switch(type)
{case 0:
{printf("The Line parameters are:\n");
printf("[Name Class Legth Rate, Res,Un(KV)]\n ");
for(i=number1;i<number2;i++)
{printf("%s,%4d,%9.2f,%5.2f,%6.2f,%6.2f\n",data[i].name,data[i].Class,data[i].paras[0],data[i].paras[1],data[i].paras[2],data[i].paras[3]);
printf(" ");
}
} break;
case 1:
{printf("The Power parameters are:\n");
printf("[Name Class Capability Xd' E'' Style]\n ");
for(i=number1;i<number2;i++)
{printf("%s,%10d,%4.2f,%6.2f,%6.2f,%6.2f\n",data[i].name,data[i].Class,data[i].paras[0],data[i].paras[1],data[i].paras[2],data[i].paras[3]);
printf(" ");
}
} break;
case 2:
{printf("The Reactance parameters are:\n");
printf("[Name Class VR(N) IR(N) XR Un(KV)]\n ");
for(i=number1;i<number2;i++)
{printf("%s,%5d,%6.2f,%6.2f,%6.2f,%6.2f\n",data[i].name,data[i].Class,data[i].paras[0],data[i].paras[1],data[i].paras[2],data[i].paras[3]);
printf(" ");
}
} break;
case 3:
{printf("The Transformer parameters are:\n");
printf("[Name Class Capability UH(KV) UL(KV) Uk(%)]\n ");
for(i=number1;i<number2;i++)
{printf("%s,%2d,%8.2f,%5.2f,%6.2f,%4.2f\n",data[i].name,data[i].Class,data[i].paras[0],data[i].paras[1],data[i].paras[2],data[i].paras[3]);
printf(" ");
}
} break;
default:break;
}
printf("\nThe paras of a component has been save!\n");
answer=1;
}
else if(low==YES)
{answer=1;}
else if(low==ESC)
{exit(0);}
else goto AAA; /*以上三个按键都不是就回去继续等待*/

getch();
return(answer);
}
/***寻找与短路点串联的线路元件***/
/**元件类型,0-表示线路,1表示电源,2表示电抗,3表示变压器**/
printf("Short Name=");
printf("%s\n",data1[record[0]].name); //打印与短路点的第一个元件名称 如,K1AD
printf("%s\n",data1[record[1]].name); //打印与短路点的第二个元件名称 如,ACK1

count1=find_fun(sum2,dir0,0,data1[record[0]].name,data1);//以短路点为首端,找出顺向串联,如K1AD

/***find_fun()函数用于保存串联的元件序号在table1[]中***/
for(i=0;i<count1;i++) //计算短路点到顺向串联的阻抗
{switch(data1[table1[i]].Class)
{case 0:{value1=data1[table1[i]].paras[0]; //0-线路,线路标么值
if(table2[i]!=0) //说明有并联
{parallel1=data1[table2[i]].paras[0];
value1=value1*parallel1/(value1+parallel1);
}
aa=value1+aa;
}break;
case 1:{value2=data1[table1[i]].paras[0];
source=data1[table1[i]].paras[2]; //电源参数
Kim[kim1]=data1[table1[i]].paras[3];
kim1++;
bb=value2+bb;
}break; //1-电源
case 2:{value3=data1[table1[i]].paras[0]; //电抗,标么值
if(table2[i]!=0) //说明有并联
{parallel2=data1[table2[i]].paras[0];
value1=value1*parallel2/(value1+parallel2);
}
cc=value3+cc;
}break; //2-电抗
case 3:{ value4=data1[table1[i]].paras[0]; //变压器标么值,已经保存在paras[0]
if(table2[i]!=0) //说明有并联
{parallel3=data1[table2[i]].paras[0];
value1=value1*parallel3/(value1+parallel3);
}
dd=dd+value4;
}break; //变压器
default:break;
}
}
value=source/(aa+bb+cc+dd); //顺向电流

printf("\nshort return value="); //错误原因,没有找到电源!
printf("%5.3f\n",value);
return(value);

}

main()
{printf("===========================Welcome To Use This Program=====================\n");
printf("==============================Statement==================================\n");
printf("\n 1 You must predigest the circuit first.\n");
printf("\n 2 You must name to every node by two letter,such as 'AB'\n");
printf("\n 3 You must follow the input format.\n");
printf("\n 4 Class [Line-0,Power sourse-1,Resistance-2,Transformer-3] \n");
printf("\n Now you can use the program if you have read the staement carefully!\n");
printf("\n\n");
Data_process();
}

估计你还是学计算机的,这么简单的问题,自己多琢磨一下吧,C语言可是很经典的东西,以上仅供参考。