commit
8adddbde24
@ -0,0 +1,133 @@
|
||||
#include<stdio.h>
|
||||
#include<string.h>
|
||||
#include<windows.h>
|
||||
#include<math.h>
|
||||
#include<stdlib.h>
|
||||
#include<time.h>
|
||||
#include<dos.h>
|
||||
#include<conio.h>
|
||||
int main()
|
||||
{
|
||||
system("color f4");
|
||||
struct BOOK
|
||||
{
|
||||
char title[20];
|
||||
char author[20];
|
||||
char publice[20];
|
||||
char time[20];
|
||||
float price;
|
||||
char locate[20];
|
||||
int base;
|
||||
//书籍名称,作者,出版社,出版日期,价格,在目录中的位置
|
||||
};
|
||||
|
||||
struct BOOK *book;
|
||||
int N=5;
|
||||
book=(struct BOOK*)malloc(N*sizeof(struct BOOK));
|
||||
strcpy( book[0].title, "《浪潮之巅》");
|
||||
strcpy( book[0].author, "吴军");
|
||||
strcpy( book[0].publice, "人民邮电出版社");
|
||||
strcpy( book[0].time, "2016年5月1日");
|
||||
book[0].price=99.00;
|
||||
strcpy( book[0].locate, "二楼302");
|
||||
book[0].base=50;
|
||||
|
||||
strcpy( book[1].title, "《人间失格》");
|
||||
strcpy( book[1].author, "太宰治");
|
||||
strcpy( book[1].publice, "现代出版社");
|
||||
strcpy( book[1].time, "2016年10月");
|
||||
book[1].price=26.00;
|
||||
strcpy( book[1].locate, "二楼302");
|
||||
|
||||
strcpy( book[2].title, "《围城》");
|
||||
strcpy( book[2].author, "钱钟书");
|
||||
strcpy( book[2].publice, "上海晨光出版社");
|
||||
strcpy( book[2].time, "1947年");
|
||||
book[2].price=40.00;
|
||||
strcpy( book[2].locate, "二楼302");
|
||||
|
||||
strcpy( book[3].title, "《红高粱家族》");
|
||||
strcpy( book[3].author, "莫言");
|
||||
strcpy( book[3].publice, "人民文学出版社");
|
||||
strcpy( book[3].time, "2007年1月");
|
||||
book[3].price=28.00;
|
||||
strcpy( book[3].locate, "二楼302");
|
||||
|
||||
strcpy( book[4].title, "《百年孤独》");
|
||||
strcpy( book[4].author, "加西亚·马尔克斯");
|
||||
strcpy( book[4].publice, "新经典文化");
|
||||
strcpy( book[4].time, "2011年6月");
|
||||
book[4].price=39.50;
|
||||
strcpy( book[4].locate, "二楼302");
|
||||
|
||||
|
||||
|
||||
char title[20],author[20];
|
||||
char *str=title;
|
||||
char *ptr=author;
|
||||
int i;
|
||||
char password[100];
|
||||
|
||||
|
||||
|
||||
{
|
||||
int num=0;
|
||||
|
||||
printf("***************欢迎来到深夜书店存货清单管理系统登录界面***************\n");
|
||||
printf(" 请输入密码");
|
||||
|
||||
while(1) //登录系统密码
|
||||
{
|
||||
scanf("%s",password);
|
||||
if(strcmp(password,"123456")==0)
|
||||
{
|
||||
printf(" 登录成功\n");
|
||||
break;
|
||||
}else
|
||||
{
|
||||
printf(" 密码错误,请重新输入");
|
||||
num++;
|
||||
if(num==3)
|
||||
{
|
||||
printf("密码输入错误超过三次,系统即将关闭");
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
system("cls"); //刷屏
|
||||
|
||||
printf("请输入您要寻找的书名和作者\n") ;
|
||||
scanf("%s%s",str,ptr);
|
||||
for(i=0;i<5;i++)
|
||||
{
|
||||
if(*str==*book[i].title&&*ptr==*book[i].author)
|
||||
{
|
||||
printf("The book is in the list.");
|
||||
printf( "书名 : %s\n", book[i].title);
|
||||
printf( "作者 : %s\n", book[i].author);
|
||||
printf( "出版社 : %s\n", book[i].publice);
|
||||
printf( "出版时间 : %s\n", book[i].time);
|
||||
printf("库存\n");
|
||||
printf("请输入所需数量:");
|
||||
int n;
|
||||
scanf("%d",n);
|
||||
if(n>(book[i].base))
|
||||
{
|
||||
printf("所需数量不在库存范围内");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*void printBook( struct BOOK *book)
|
||||
{
|
||||
printf( "Book title : %s\n", book->title);
|
||||
printf( "Book author : %s\n", book->author);
|
||||
printf( "Book publice : %s\n", book->publice);
|
||||
printf( "Book time : %s\n", book->time);
|
||||
}
|
||||
*/
|
||||
|
Loading…
Reference in new issue