commit 8adddbde2455f652109478cd00f8fb7a5fe245e2 Author: 18408000636@stu.hut.edu.cn <18408000636@stu.hut.edu.cn> Date: Tue Dec 11 09:07:50 2018 +0800 first commit diff --git a/课程设计.c b/课程设计.c new file mode 100644 index 0000000..8e92d9d --- /dev/null +++ b/课程设计.c @@ -0,0 +1,133 @@ +#include +#include +#include +#include +#include +#include +#include +#include +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); +} +*/ + diff --git a/课程设计.exe b/课程设计.exe new file mode 100644 index 0000000..22ef041 Binary files /dev/null and b/课程设计.exe differ