first commit

master
unknown 6 years ago
parent 8adddbde24
commit 1c64a60706

Binary file not shown.

@ -5,10 +5,10 @@
#include<stdlib.h> #include<stdlib.h>
#include<time.h> #include<time.h>
#include<dos.h> #include<dos.h>
#include<conio.h> #include<conio.h>
int main() int main()
{ {
system("color f4"); system("color f4");
struct BOOK struct BOOK
{ {
char title[20]; char title[20];
@ -59,49 +59,78 @@ int main()
strcpy( book[4].time, "2011年6月"); strcpy( book[4].time, "2011年6月");
book[4].price=39.50; book[4].price=39.50;
strcpy( book[4].locate, "二楼302"); strcpy( book[4].locate, "二楼302");
char title[20],author[20];
char *str=title;
char *ptr=author; struct user
int i; {
char password[100]; char user_name[100];
char user_pass[100];
}stu[2]={{"xiaocong001","123456"},{"zhuzhu002","123456"}};
int num1=0;
{ int num2=0;
int num=0; printf("***************欢迎来到深夜书店存货清单管理系统登录界面***************\n"); //登录系统
while(1)
printf("***************欢迎来到深夜书店存货清单管理系统登录界面***************\n"); {
printf(" 请输入密码"); printf("\t\t请输入您的用户名:");
char u[100];
while(1) //登录系统密码
scanf("%s",u);
if(strcmp(stu[0].user_name,u)==0||strcmp(stu[1].user_name,u)==0)
{
break;
}
else{
printf("不存在此用户!请重新输入!\n");
num1++;
if(num1==3)
{
printf("\n\t\t很抱歉,您没有权限进入系统!\n");
exit(0); }
}
}
system("cls");
printf("***************欢迎来到深夜书店存货清单管理系统登录界面***************\n");
printf("\t\t请输入密码:");
while(1)
{ {
scanf("%s",password); char p[100];
if(strcmp(password,"123456")==0) scanf("%s",p);
if(strcmp(stu[0].user_pass,p)==0)
{ {
printf(" 登录成功\n"); printf(" 登录成功\n");
break; break;
}else }else
{ {
printf(" 密码错误,请重新输入"); printf(" 密码错误,请重新输入");
num++; num2++;
if(num==3) if(num2==3)
{ {
printf("密码输入错误超过三次,系统即将关闭"); printf("密码输入错误超过三次,系统即将关闭");
exit(0); exit(0);
} }
} }
} }
system("cls"); //刷屏 system("cls"); //刷屏
system("color e5");
char t[20],a[20];
int i;
printf("请输入您要寻找的书名和作者\n") ; printf("请输入您要寻找的书名和作者\n") ;
scanf("%s%s",str,ptr); scanf("%s%s",&t,&a);
for(i=0;i<5;i++) for(i=0;i<5;i++)
{ {
if(*str==*book[i].title&&*ptr==*book[i].author) if((strcmp(t,book[i].title)==0))
{ {
if((strcmp(a,book[i].author)==0))
{
printf("The book is in the list."); printf("The book is in the list.");
printf( "书名 : %s\n", book[i].title); printf( "书名 : %s\n", book[i].title);
printf( "作者 : %s\n", book[i].author); printf( "作者 : %s\n", book[i].author);
@ -110,24 +139,21 @@ int main()
printf("库存\n"); printf("库存\n");
printf("请输入所需数量:"); printf("请输入所需数量:");
int n; int n;
scanf("%d",n); scanf("%d",&n);
if(n>(book[i].base)) if(n>(book[i].base))
{ {
printf("所需数量不在库存范围内"); printf("所需数量不在库存范围内");
}
else
{
book[i].base=book[i].base - n;
printf("已选定%d 本 %s\n",n,book[i].title);
} }
} }
} }
}
return 0; 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);
}
*/

Binary file not shown.
Loading…
Cancel
Save