first commit

master
unknown 6 years ago
parent 8adddbde24
commit 1c64a60706

Binary file not shown.

@ -62,32 +62,52 @@ int main()
char title[20],author[20];
char *str=title;
char *ptr=author;
int i;
char password[100];
struct user
{
char user_name[100];
char user_pass[100];
}stu[2]={{"xiaocong001","123456"},{"zhuzhu002","123456"}};
int num1=0;
int num2=0;
printf("***************欢迎来到深夜书店存货清单管理系统登录界面***************\n"); //登录系统
while(1)
{
printf("\t\t请输入您的用户名:");
char u[100];
scanf("%s",u);
if(strcmp(stu[0].user_name,u)==0||strcmp(stu[1].user_name,u)==0)
{ {
int num=0; break;
}
else{
printf("不存在此用户!请重新输入!\n");
num1++;
if(num1==3)
{
printf("\n\t\t很抱歉,您没有权限进入系统!\n");
exit(0); }
}
}
system("cls");
printf("***************欢迎来到深夜书店存货清单管理系统登录界面***************\n"); printf("***************欢迎来到深夜书店存货清单管理系统登录界面***************\n");
printf(" 请输入密码"); printf("\t\t请输入密码:");
while(1)
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);
@ -95,12 +115,21 @@ int main()
} }
} }
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);
@ -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