c语言 图书管理系统 源代码( 三 )


}
if(l==0)
{
printf("\n");
printf("起未找该图书信息\n\n");
}
else
{
printf("\n");
printf("****************************************\n");
printf("编号书名作者版社版间价格状态借阅者\n");
printf("\n");
printf("%s%s%s%s%s%s%s%s",nn.number,nn.tittle,nn.writer,nn.publisher,***.date,nn.price,nn.status,nn.reader);
printf("请依修改图书信息\n\n\n");
fflush(stdin);
scanf("%s%s%s%s%s%s%s%s",n.number,n.tittle,n.writer,n.publisher,n.date,n.price,n.status,n.reader);
fseek(fp,sizeof(nn),1);
fwrite(&n,sizeof(nn),1,fp);
}
printf("\n");
printf("否继续修改用户信息[y/n]?\n\n");
do
{
x=getch();
}while(x!='n'&&x!='y');
if(x=='n')
break;
}
fclose(fp);
system("cls");
}
//借书
voidborrow_book()
{
FILE*fp;
structbookn;
structbooknn;
charx,z;
intl,r;
fp=fopen("F:\\课程设计\\图书管理系统.txt","rb+");
while(1)
{
l=0;
system("cls");
printf("\n");
printf("请输入需要借阅图书名:\n");
fflush(stdin);
scanf("%s",&n.tittle);
rewind(fp);
while(1)
{
fread(&nn,sizeof(nn),1,fp);
if(feof(fp))
break;
r=strcmp(n.tittle,nn.tittle);
if(r==0)
{
l=1;
break;
}
}
if(l==0)
{
printf("\n");
printf("起未找该图书\n");
}
else
{printf("\n");
printf("****************************************\n");
printf("编号书名作者版社版间价格状态借阅者\n");
printf("\n");
printf("%s%s%s%s%s%s%s%s",nn.number,nn.tittle,nn.writer,nn.publisher,***.date,nn.price,nn.status,nn.reader);
printf("\n");
fflush(stdin);
printf("请输入图书信息并修改库状态及借阅者信息");
printf("****************************************\n");
printf("编号书名作者版社版间价格状态借阅者\n");
printf("\n");
scanf("%s%s%s%s%s%s%s%s",n.number,n.tittle,n.writer,n.publisher,n.date,n.price,n.status,n.reader);
fseek(fp,sizeof(nn),1);
fwrite(&n,sizeof(nn),1,fp);
}
printf("\n");
printf("否继续借书[(y)/否(n)]\n\n");
do
{
x=getch();
}while(x!='n'&&x!='y');
if(x=='n')
break;
}
fclose(fp);
system("cls");
}
//书
voidreturn_book()
{
FILE*fp;
structbookn;
structbooknn;
charx,z;
intl,r;
fp=fopen("F:\\课程设计\\图书管理系统.txt","rb+");
while(1)
{
l=0;
system("cls");
printf("\n");
printf("请输入需要借图书名:\n");
fflush(stdin);
scanf("%s",&n.tittle);
rewind(fp);
while(1)
{
fread(&nn,sizeof(nn),1,fp);
if(feof(fp))
break;
r=strcmp(n.tittle,nn.tittle);
if(r==0)
{
l=1;
break;
}
}
if(l==0)
{
printf("\n");
printf("起未找该图书\n");
}
else
{
printf("\n");
printf("****************************************\n");
printf("编号书名作者版社版间价格状态借阅者\n");
printf("\n");
printf("%s%s%s%s%s%s%s%s",nn.number,nn.tittle,nn.writer,nn.publisher,***.date,nn.price,nn.status,nn.reader);
printf("\n");
fflush(stdin);
printf("请输入图书信息并修改库状态\n\n");
printf("****************************************\n");
printf("编号书名作者版社版间价格状态借阅者\n");
printf("\n");
scanf("%s%s%s%s%s%s%s%s",n.number,n.tittle,n.writer,n.publisher,n.date,n.price,n.status,n.reader);
fseek(fp,-(int)sizeof(nn),1);
fwrite(&n,sizeof(nn),1,fp);
}

推荐阅读