You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

160 lines
3.7 KiB

6 years ago
#include<stdio.h>
#include<string.h>
#include<windows.h>
#include<math.h>
#include<stdlib.h>
#include<time.h>
#include<dos.h>
6 years ago
#include<conio.h>
6 years ago
int main()
{
6 years ago
system("color f4");
6 years ago
struct BOOK
{
char title[20];
char author[20];
char publice[20];
char time[20];
float price;
char locate[20];
int base;
//<2F><EFBFBD><E9BCAE><EFBFBD>ƣ<EFBFBD><C6A3><EFBFBD><EFBFBD>ߣ<EFBFBD><DFA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E7A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><DAA3>۸<EFBFBD><DBB8><EFBFBD><EFBFBD><EFBFBD>Ŀ¼<C4BF>е<EFBFBD>λ<EFBFBD><CEBB>
};
struct BOOK *book;
int N=5;
book=(struct BOOK*)malloc(N*sizeof(struct BOOK));
strcpy( book[0].title, "<EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD>֮<EFBFBD>ۡ<EFBFBD>");
strcpy( book[0].author, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
strcpy( book[0].publice, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
strcpy( book[0].time, "2016<EFBFBD><EFBFBD>5<EFBFBD><EFBFBD>1<EFBFBD><EFBFBD>");
book[0].price=99.00;
strcpy( book[0].locate, "<EFBFBD><EFBFBD>¥302");
book[0].base=50;
strcpy( book[1].title, "<EFBFBD><EFBFBD><EFBFBD>˼<EFBFBD>ʧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
strcpy( book[1].author, "̫<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
strcpy( book[1].publice, "<EFBFBD>ִ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
strcpy( book[1].time, "2016<EFBFBD><EFBFBD>10<EFBFBD><EFBFBD>");
book[1].price=26.00;
strcpy( book[1].locate, "<EFBFBD><EFBFBD>¥302");
strcpy( book[2].title, "<EFBFBD><EFBFBD>Χ<EFBFBD>ǡ<EFBFBD>");
strcpy( book[2].author, "Ǯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
strcpy( book[2].publice, "<EFBFBD>Ϻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
strcpy( book[2].time, "1947<EFBFBD><EFBFBD>");
book[2].price=40.00;
strcpy( book[2].locate, "<EFBFBD><EFBFBD>¥302");
strcpy( book[3].title, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
strcpy( book[3].author, "Ī<EFBFBD><EFBFBD>");
strcpy( book[3].publice, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
strcpy( book[3].time, "2007<EFBFBD><EFBFBD>1<EFBFBD><EFBFBD>");
book[3].price=28.00;
strcpy( book[3].locate, "<EFBFBD><EFBFBD>¥302");
strcpy( book[4].title, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
strcpy( book[4].author, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˹");
strcpy( book[4].publice, "<EFBFBD>¾<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD>");
strcpy( book[4].time, "2011<EFBFBD><EFBFBD>6<EFBFBD><EFBFBD>");
book[4].price=39.50;
strcpy( book[4].locate, "<EFBFBD><EFBFBD>¥302");
6 years ago
struct user
{
char user_name[100];
char user_pass[100];
}stu[2]={{"xiaocong001","123456"},{"zhuzhu002","123456"}};
int num1=0;
int num2=0;
printf("***************<2A><>ӭ<EFBFBD><D3AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҹ<EFBFBD><D2B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E5B5A5><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>***************\n"); //<2F><>¼ϵͳ
while(1)
{
printf("\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
char u[100];
scanf("%s",u);
if(strcmp(stu[0].user_name,u)==0||strcmp(stu[1].user_name,u)==0)
{
break;
}
else{
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
num1++;
if(num1==3)
{
printf("\n\t\t<EFBFBD>ܱ<EFBFBD>Ǹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD>Ȩ<EFBFBD>޽<EFBFBD><EFBFBD><EFBFBD>ϵͳ<EFBFBD><EFBFBD>\n");
exit(0); }
}
}
system("cls");
printf("***************<2A><>ӭ<EFBFBD><D3AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҹ<EFBFBD><D2B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E5B5A5><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>***************\n");
printf("\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
while(1)
6 years ago
{
6 years ago
char p[100];
scanf("%s",p);
if(strcmp(stu[0].user_pass,p)==0)
6 years ago
{
printf(" <20><>¼<EFBFBD>ɹ<EFBFBD>\n");
break;
}else
{
printf(" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
6 years ago
num2++;
if(num2==3)
6 years ago
{
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>󳬹<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Σ<EFBFBD>ϵͳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD>");
6 years ago
exit(0);
6 years ago
}
}
}
6 years ago
system("cls"); //ˢ<><CBA2>
system("color e5");
char t[20],a[20];
int i;
6 years ago
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҪѰ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n") ;
6 years ago
scanf("%s%s",&t,&a);
6 years ago
for(i=0;i<5;i++)
{
6 years ago
if((strcmp(t,book[i].title)==0))
6 years ago
{
6 years ago
if((strcmp(a,book[i].author)==0))
{
6 years ago
printf("The book is in the list.");
printf( "<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : %s\n", book[i].title);
printf( "<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : %s\n", book[i].author);
printf( "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : %s\n", book[i].publice);
printf( "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD> : %s\n", book[i].time);
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
int n;
6 years ago
scanf("%d",&n);
6 years ago
if(n>(book[i].base))
{
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><EFBFBD>Χ<EFBFBD><EFBFBD>");
6 years ago
}
else
{
book[i].base=book[i].base - n;
printf("<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD>%d <20><> %s\n",n,book[i].title);
6 years ago
}
}
}
6 years ago
}
6 years ago
return 0;
}