|
|
@ -1,6 +1,7 @@
|
|
|
|
#include<stdio.h>
|
|
|
|
#include<stdio.h>
|
|
|
|
#include<string.h>
|
|
|
|
#include<string.h>
|
|
|
|
struct book
|
|
|
|
#include<stdlib.h>
|
|
|
|
|
|
|
|
struct book //
|
|
|
|
{
|
|
|
|
{
|
|
|
|
char name[100];
|
|
|
|
char name[100];
|
|
|
|
char writer[20];
|
|
|
|
char writer[20];
|
|
|
@ -10,53 +11,74 @@
|
|
|
|
int place;
|
|
|
|
int place;
|
|
|
|
int number;
|
|
|
|
int number;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
struct book a[5]={
|
|
|
|
struct book a[10]=
|
|
|
|
|
|
|
|
{
|
|
|
|
{"dujie","dujie","hunangongyedaxue",20180104,20.00,1,50},
|
|
|
|
{"dujie","dujie","hunangongyedaxue",20180104,20.00,1,50},
|
|
|
|
{"lingyu","lingyu","hunangongyedaxue",20181220,38.00,2,38},
|
|
|
|
{"lingyu","lingyu","hunangongyedaxue",20181220,38.00,2,38},
|
|
|
|
{"zhoutao","zhoutao","hunangongyedaxue",20181010,27.00,3,27},
|
|
|
|
{"zhoutao","zhoutao","hunangongyedaxue",20181010,27.00,3,27},
|
|
|
|
{"liuyan","liuyan","hunangongyedaxue",20180308,1.00,4,100},
|
|
|
|
{"liuyan","liuyan","hunangongyedaxue",20180308,1.00,4,100},
|
|
|
|
{"liubo","liubo","hunangongyedaxue",20180502,20.00,5,38},
|
|
|
|
{"liubo","liubo","hunangongyedaxue",20180502,20.00,5,38},
|
|
|
|
|
|
|
|
{"lukebing","lukebing","hunangongyedaxue",20170506,6,320},
|
|
|
|
|
|
|
|
{"xiangyunfan","xiangyunfan","hunnangongyedaxue",20190321,7,50},
|
|
|
|
|
|
|
|
{"西游记","吴承恩","中国",10001010,66.00,8,900},
|
|
|
|
|
|
|
|
{"水浒传","施耐庵","中国",10201127,56.00,9,600},
|
|
|
|
|
|
|
|
{"红楼梦","曹雪芹","中国",20150325,47.00,10,200},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main()
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int i,n,m,j;
|
|
|
|
printf("********************======================书店存货清单=====================******************");
|
|
|
|
char name[100],writer[100];
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
printf("请输入搜索内容\n");
|
|
|
|
flag:;
|
|
|
|
system("color A5");
|
|
|
|
gets(name);
|
|
|
|
int i=0,n;
|
|
|
|
gets(writer);
|
|
|
|
char m,name[100],writer[100];
|
|
|
|
for(i=0;i<5;i++)
|
|
|
|
flag:printf("书名");
|
|
|
|
|
|
|
|
scanf("%s",name);
|
|
|
|
|
|
|
|
printf("作者名");
|
|
|
|
|
|
|
|
scanf("%s",writer);
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
{
|
|
|
|
j=0;
|
|
|
|
|
|
|
|
j++;
|
|
|
|
|
|
|
|
if(strcmp(name,a[i].name)==0 && strcmp(writer,a[i].writer)==0)
|
|
|
|
if(strcmp(name,a[i].name)==0 && strcmp(writer,a[i].writer)==0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("书名");
|
|
|
|
printf("书名 ");
|
|
|
|
puts(a[i].name);
|
|
|
|
puts(a[i].name);
|
|
|
|
printf("作者");
|
|
|
|
printf("作者 ");
|
|
|
|
puts(a[i].writer);
|
|
|
|
puts(a[i].writer);
|
|
|
|
printf("出版社");
|
|
|
|
printf("出版社 ");
|
|
|
|
puts(a[i].pulish);
|
|
|
|
puts(a[i].pulish);
|
|
|
|
printf("日期 %d",a[i].date);
|
|
|
|
printf("日期 %d\n",a[i].date);
|
|
|
|
printf("价格 %.2f",a[i].price);
|
|
|
|
printf("价格 %.2f\n",a[i].price);
|
|
|
|
printf("位置 %d\n",a[i].place);
|
|
|
|
printf("位置 %d\n",a[i].place);
|
|
|
|
printf("请输入所需数量\n");
|
|
|
|
printf("请输入所需数量\n");
|
|
|
|
scanf("%d",&n);
|
|
|
|
scanf("%d",&n);
|
|
|
|
if(n<=a[i].number)
|
|
|
|
if(n<=a[i].number)
|
|
|
|
printf("%f",(n*a[i].price));
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("%.2f\n",(n*a[i].price));
|
|
|
|
|
|
|
|
a[i].number-=n;
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
printf("所需数量不在库存范围内\n");
|
|
|
|
printf("所需数量不在库存范围内\n");
|
|
|
|
printf("是否还想买其他书籍 是 y或Y,否 双击回车键\n");
|
|
|
|
printf("是否还想买其他书籍 是 y或Y,否 按任意键返回\n");
|
|
|
|
scanf("%d",&m);
|
|
|
|
scanf("%s",&m);
|
|
|
|
if(m=='y'||m=='Y')
|
|
|
|
if(m=='y'||m=='Y')
|
|
|
|
j=0;
|
|
|
|
{
|
|
|
|
|
|
|
|
i=0;
|
|
|
|
goto flag;
|
|
|
|
goto flag;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(j=5)
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
j=0;
|
|
|
|
break;
|
|
|
|
printf("谢谢,再见!");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
i++;
|
|
|
|
|
|
|
|
if(i==10)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("你想买的书籍不存在!\n");
|
|
|
|
|
|
|
|
printf("谢谢,再见!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}while(i<10);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|