【文章內容簡介】
功能模塊]可參照[會員租借、歸還 DVD模塊]的設計方法。 [會員信息修改的功能模塊] 設計思路:可參照[會員租借、歸還 DVD模塊]的設計方法。 【針對第四點:操作界面單調問題】 改進思路: C語言是面向過程的語言,當時語言開發(fā)的程序主要是面向 DOS用戶,雖 具有較強的繪圖功能等等功能,但主要還是面向 DOS的。當今的主流語言是面向對象的語言,開發(fā)的平臺大多為 WINDOWS 界面平 臺,開發(fā)的程序也主要是 WINDOWS組件基礎之上的圖形界面程序,故可將程序要求移植到 VC++之上,借助 VC++強大的功能,編寫 WINDOWS 界面程序,利用 API接口函數方便調用各種 WINDOWS強大功能,服務程序,使程序更加豐富、直觀、生動、高效。 第 17 頁 共 25 頁 第七部分:附錄(源代碼) *原創(chuàng) * C 語言源代碼: /*本代碼為“電影俱樂部管理系統”源代碼,代碼為中國地質大學(武漢) 041051 班章斌原創(chuàng),編寫代碼時多處采用原創(chuàng)的高效的算法。 */ /*代碼包含的函數庫申明 */ include include /*定義 DVD 信息結構體 */ typedef struct DVDinfo { char No[10]。 char name[10]。 int state。 }DI。 /*定義會員信息結構體 */ typedef struct MemberInfo { char No[10]。 char name[10]。 char password[20]。 float balance。 DI borrowDVD[3]。 int state。 }MI。 /*會員按月自動繳費模塊 */ void month() { FILE *fp1。 FILE *fp2。 MI mem[500]。 int month。 int pmonth。 int cost。 int j。 int i。 struct date curr_date。 getdate(amp。curr_date)。 month=。 fp1=fopen(month,r+)。 fp2=fopen(meminfo,r+)。 if(fp1==NULL)exit(0)。 if(fp2==NULL)exit(0)。 fread(amp。pmonth,sizeof(int),1,fp1)。 if(pmonth!=month) { cost=5*abs(monthpmonth)。 for(j=0。fread(amp。mem[j],sizeof(struct MemberInfo),1,fp2)!=0。j++) { mem[j].balance=cost。 } rewind(fp2)。 for(i=0。ij。i++)fwrite(amp。mem[i],sizeof(struct MemberInfo),1,fp2)。 } fwrite(amp。month,sizeof(int),1,fp1)。 第 18 頁 共 25 頁 fclose(fp1)。 fclose(fp2)。 } /*會員注冊模塊 */ int reg() { FILE *fp。 MI newmem。 int choice。 int i=0。 int result。 fp=fopen(meminfo,r+)。 clrscr()。 printf(***************************************************\n)。 printf(Please fill in the information of new members\n)。 printf(***************************************************\n)。 printf(The movie club rules:\n)。 printf( pay for your renting every month per month\n)。 printf( are allowed to rent less than 4 DVDs\n)。 printf( protect DVDs you rented from club\n)。 printf(If you destory it,you will pay for it\n)。 printf( remember your own password that is very\n)。 printf( you fet it,you will afford all\n)。 printf(\n)。 printf(Do you agree all above?\n)。 printf(\n)。 printf(\n)。 printf(\n)。 printf(\n)。 printf(Your chice:\n)。 scanf(%d,amp。result)。 if(result==1) { printf(\n)。 printf(Please input your nickname:\n)。 scanf(%s,)。 printf(Please input your true name:\n)。 scanf(%s,)。 printf(Please input your password:\n)。 scanf(%s,)。 for(。i3。i++) { strcpy([i].No,)。 strcpy([i].name,)。 [i].state=0。 } =0。 =0。 if(fp==NULL)exit(0)。 fseek(fp,0L,2)。 fwrite(amp。newmem,sizeof(struct MemberInfo),1,fp)。 fclose(fp)。 } printf(\n)。 printf( value of my balance now\n)。 printf( to wele page\n)。 printf(\n)。 printf(Your Choice:)。 scanf(%d,amp。choice)。 if(choice==1)return(2)。 if(choice==2)return(1)。 } 第 19 頁 共 25 頁 /*添加 DVD 信息入庫模塊 */ int adddvd() { FILE *fp。 DI newdvd。 fp=fopen(dvdinfo,r+)。 if(fp==NULL)exit(0)。 clrscr()。 printf(*****************************************\n)。 printf(Please fill in the information of new DVD\n)。 printf(*****************************************\n)。 printf(Please input DVD number:\n)。 scanf(%s,)。 printf(Please input DVD name:\n)。 scanf(%s,)。 printf(Please input DVD state:\n)。 scanf(%d,amp。)。 fseek(fp,0L,2)。 fwrite(amp。newdvd,sizeof(struct DVDinfo),1,fp)。 fclose(fp)。 } /*會員賬戶充值模塊 */ void money(char name[]) { MI fuser[500]。 int i。 int j。 float balance。 FILE *fp。 clrscr()。 printf(***********************************************\n)。 printf(You are being to increase value of your balance\n)。 printf(***********************************************\n)。 fp=fopen(meminfo,r+)。 if(fp==NULL)exit(0)。 for(i=0。fread(amp。fuser[i],sizeof(struct MemberInfo),1,fp)!=0。i++) { if(strcmp(fuser[i].name,name)==0) { printf(The value you want to increase:)。 scanf(%f,amp。balance)。 fuser[i].balance+=balance。 printf(\n)。 printf(OK,now your balance is:%f\n,fuser[i].balance)。 getch()。 } } rewind(fp)。 for(j=0。ji。j++)fwrite(amp。fuser[j],sizeof(struct MemberInfo),1,fp)。 fclo