struct sushe *intput_shuji()
{
int jisuan(char a[]);
FILE *out;
char ch,outfile[256];
int n=0;
char line[1024];
struct sushe *head;
struct sushe *p,*q;
head=p=(struct sushe*)malloc(sizeof(struct sushe)); //申请一个空间,头指针head为空的
printf("输入读入文件的名字:");
scanf("%s",outfile);
if((out=fopen(outfile,"r"))==NULL)
{
printf("无法打开此文件\n");
exit(0);
}
while(!feof(out))
{
q=(struct sushe*)malloc(sizeof(struct sushe));
p->next=q;
p=q;
fgets(line,50,out);
sscanf(line,"%s %s %d %s %d %d %d",p->area,p->storey,&p->number,p->name,&p->electric,&p->water,&p->drink);
}
q->next=NULL;
fclose(out);
return head;//返回头指针
}
{
int jisuan(char a[]);
FILE *out;
char ch,outfile[256];
int n=0;
char line[1024];
struct sushe *head;
struct sushe *p,*q;
head=p=(struct sushe*)malloc(sizeof(struct sushe)); //申请一个空间,头指针head为空的
printf("输入读入文件的名字:");
scanf("%s",outfile);
if((out=fopen(outfile,"r"))==NULL)
{
printf("无法打开此文件\n");
exit(0);
}
while(!feof(out))
{
q=(struct sushe*)malloc(sizeof(struct sushe));
p->next=q;
p=q;
fgets(line,50,out);
sscanf(line,"%s %s %d %s %d %d %d",p->area,p->storey,&p->number,p->name,&p->electric,&p->water,&p->drink);
}
q->next=NULL;
fclose(out);
return head;//返回头指针
}