该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
在后面temp=fwrite(temp,struct book *temp,1,fp); //就过不去了
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include "stdlib.h"
#include "malloc.h"
struct book
{
char num[20]; //书号
char name[10]; //书名
int jinjia; //进价
int shoujia; //售价
int shuliang; //库存数量
int shouchu; //售出
struct book *next;
};
struct book *creat(struct book*head)//创建
{
struct book *p1,*p2;
p1=p2=(struct book*)malloc(sizeof(struct book));
printf("*************************\n");
printf("\t请输入书号\n");
printf("*************************\n");
scanf("%s",&p1->num);
if(atoi(p1->num)<0)
exit(0);
system("cls");
printf("*************************\n");
printf("请输入书号为%s的书名\n",p1->num);
printf("*************************\n");
scanf("%s",&p1->name);
system("cls");
printf("*****************************\n");
printf("请输入书号为%s的进书的数量\n",p1->num);
printf("*****************************\n");
scanf("%d",&p1->shuliang);
system("cls");
printf("*************************\n");
printf("请输入书号为%s的进价\n",p1->num);
printf("*************************\n",p1->num);
scanf("%d",&p1->jinjia);
system("cls");
printf("*************************\n");
printf("请输入书号为%s的售价\n",p1->num);
printf("*************************\n",p1->num);
scanf("%d",&p1->shoujia);
system("cls");
p1->next=NULL;
while(atoi(p1->num)>0)
{
if(head==NULL)
head=p1;
else
p2->next=p1;