服务器之家:专注于服务器技术及软件下载分享
分类导航

PHP教程|ASP.NET教程|Java教程|ASP教程|编程技术|正则表达式|C/C++|IOS|C#|Swift|Android|VB|R语言|JavaScript|易语言|vb.net|

服务器之家 - 编程语言 - C/C++ - C语言图书管理系统课程设计

C语言图书管理系统课程设计

2021-06-15 13:29iamskying C/C++

这篇文章主要为大家详细介绍了C语言图书管理系统课程设计,具有一定的参考价值,感兴趣的小伙伴们可以参考一下

这是本人大一第二学期初C语言课程设计的作品,嘿嘿,本来以为已经找不到原稿了,今天无意中竟然在QQ网络硬盘中找到了当初的teta版,发布于此,以作纪念。

C语言图书管理系统课程设计C

源代码如下:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct book{
  char book_name[30];
  int bianhao;
  double price;
  char author[20];
  char state[20];
  char name[20];
  char sex[10];
  int xuehao;
  struct book *book_next;
};
struct club{
  char name[20];
  char sex[10];
  int xuehao;
  char borrow[30];
  struct club *club_next;
};
void Print_Book(struct book *head_book);/*浏览所有图书信息*/
void Print_Club(struct club *head_club);/*浏览所有会员信息*/
struct book *Create_New_Book();/*创建新的图书库,图书编号输入为0时结束*/
struct book *Search_Book_bianhao(int bianhao,struct book *head_book);
struct book *Search_Book_name(char *b_name,struct book *head_book);
struct book *Search_Book_price(double price_h,double price_l,struct book *head_book);
struct book *Insert_Book(struct book *head_book,struct book *stud_book);/*增加图书,逐个添加*/
struct book *Delete_Book(struct book *head_book,int bianhao);/*删除图书*/
struct club *Create_New_Club();
struct club *Search_Club_xuehao(int xuehao,struct club *head_club);
struct club *Search_Club_name(char *c_name,struct club *head_club);
struct club *Insert_Club(struct club *head_club,struct club *stud_club);
struct club *Delete_Club(struct club *head_club,int xuehao);
struct book *Lent_Book(int bianhao,int xuehao,struct book *head_book,struct club *head_club);
struct book *back(int bianhao,int xuehao,struct book *head_book,struct club *head_club);
int main()
{
  struct book *head_book,*p_book;
  char book_name[30],name[20],author[20],sex[10];
  int bianhao;
  double price,price_h,price_l;
  int size_book=sizeof(struct book);
  int m=1,n=1,f;
  char *b_name,*c_name;
  struct club *head_club,*p_club;
  int xuehao;
  int size_club=sizeof(struct club);
   
  int choice;
  printf("/n欢迎您第一次进入图书管理系统!/n/n");
  printf("----->[向导]----->[新建图书库]/n/n");
  printf("注意:当输入图书编号为0时,进入下一步./n/n");
  head_book=Create_New_Book();
  system("cls");
  printf("/n欢迎您第一次进入图书管理系统!/n/n");
  printf("----->[向导]----->[新建会员库]/n/n");
  printf("注意:当输入会员学号为0时,进入主菜单./n/n");
  head_club=Create_New_Club();
  system("cls");
  do
    printf("/n/t/t/t〓〓〓〓〓图书管理系统〓〓〓〓〓/n/n");
    printf("/n");
    printf("/t/t/t[1]:借书办理/t");printf(" [6]:还书办理/n");
    printf("/n");
    printf("/t/t/t[2]:查询图书/t");printf(" [7]:查询会员/n");
    printf("/t/t/t[3]:添加图书/t");printf(" [8]:添加会员/n");
    printf("/t/t/t[4]:删除图书/t");printf(" [9]:删除会员/n");
    printf("/t/t/t[5]:遍历图书/t");printf("[10]:遍历会员/n/n");
    printf("/t/t/t〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓/n/n");
    printf("/t/t/t0:退出/n/n");
    printf("请选择<0~10>:");
    scanf("%d",&choice);
    switch(choice){
    case 1:
      printf("/n/t/t/t〓〓〓〓〓图书管理系统〓〓〓〓〓/n/n");
      printf("输入所借图书编号:/n");
      scanf("%d",&bianhao);
      printf("输入借书人的学号:/n");
      scanf("%d",&xuehao);
      head_book=Lent_Book(bianhao,xuehao,head_book,head_club);
      system("cls");
      printf("/n借阅成功!/n/n");
      printf("相关信息如下:/n/n");
      head_book=Search_Book_bianhao(bianhao,head_book);
      break;
    case 2:
      system("cls");
      printf("/n/t/t/t〓〓〓〓〓图书管理系统〓〓〓〓〓/n/n");
      printf("1.按编号查询/n/n");
      printf("2.按名称查询/n/n");
      printf("3.按价格区间查询/n/n");
      printf("0.返回主菜单/n/n");
      printf("请选择:");
      scanf("%d",&f);
      if(f==1){
        printf("请输入查询图书编号:");
        scanf("%d",&bianhao);
        printf("相关信息如下:/n/n");
        head_book=Search_Book_bianhao(bianhao,head_book);
        break;
      }
      else if(f==2){
        b_name=book_name;
        getchar();
        printf("请输入查询图书名称:");
        gets(b_name);
        printf("相关信息如下:/n/n");
        head_book=Search_Book_name(b_name,head_book);
        break;
      }
      else if(f==3){
        printf("请输入最高价格:");
        scanf("%lf",&price_h);
        printf("请输入最低价格:");
        scanf("%lf",&price_l);
        printf("相关信息如下:/n/n");
        head_book=Search_Book_price(price_h,price_l,head_book);
        break;
      }
      else if(f==0){
        break;
      }
      break;
    case 6:
      printf("/n/t/t/t〓〓〓〓〓图书管理系统〓〓〓〓〓/n/n");
      printf("输入所还图书编号:/n");
      scanf("%d",&bianhao);
      printf("输入还书人的学号:/n");
      scanf("%d",&xuehao);
      head_book=back(bianhao,xuehao,head_book,head_club);
      system("cls");
      printf("/n归还成功!/n/n");
      printf("相关信息如下:/n/n");
      head_book=Search_Book_bianhao(bianhao,head_book);
      break;
    case 3:
      system("cls");
      printf("/n/t/t/t〓〓〓〓〓图书管理系统〓〓〓〓〓/n/n");
      printf("请输入图书名称:");
      scanf("%s",book_name);
      printf("请输入图书编号:");
      scanf("%d",&bianhao);
      printf("请输入单价:");
      scanf("%lf",&price);
      printf("请输入作者名字:");
      scanf("%s",author);
      printf("/n");
      struct book *ptr_b;
      for(ptr_b=head_book;ptr_b;ptr_b=ptr_b->book_next)
      {
      if(ptr_b->bianhao==bianhao)
      {
        printf("此编号图书已存在/n");
        m=0;
        break;
      }
      }
      if(m){
      p_book=(struct book *)malloc(size_book);
      strcpy(p_book->book_name,book_name);
      p_book->bianhao=bianhao;
      p_book->price=price;
      p_book->xuehao=0;
      strcpy(p_book->author,author);
      strcpy(p_book->state,"存在");
      strcpy(p_book->sex,"待定");
      strcpy(p_book->name,"待定");
      head_book=Insert_Book(head_book,p_book);
      printf("/n添加图书成功!/n/n");
      }
      break;
    case 4:
      system("cls");
      printf("/n/t/t/t〓〓〓〓〓图书管理系统〓〓〓〓〓/n/n");
      printf("输入删除图书编号:/n");
      scanf("%d",&bianhao);
      head_book=Delete_Book(head_book,bianhao);
      printf("/n删除图书成功!/n/n");
      break;
    case 5:
      system("cls");
      printf("/n/t/t/t〓〓〓〓〓图书管理系统〓〓〓〓〓/n/n");
      Print_Book(head_book);
      break;
    case 7:
      system("cls");
      printf("/n/t/t/t〓〓〓〓〓图书管理系统〓〓〓〓〓/n/n");
      printf("1.按学号查询/n/n");
      printf("2.按姓名查询/n/n");
      printf("0.返回主菜单/n/n");
      printf("请选择:");
      scanf("%d",&f);
      if(f==1){
        printf("请输入查询会员学号:");
        scanf("%d",&xuehao);
        printf("相关信息如下:/n/n");
        head_club=Search_Club_xuehao(xuehao,head_club);
        break;
      }
      else if(f==2){
        c_name=name;
        getchar();
        printf("请输入查询会员姓名:");
        gets(c_name);
        printf("相关信息如下:/n/n");
        head_club=Search_Club_name(c_name,head_club);
        break;
      }
      else if(f==0){
        break;
      }
      break;
      printf("请输入查询会员学号:/n");
      scanf("%d",&xuehao);
      printf("相关信息如下:/n/n");
       
      break;
    case 8:
      system("cls");
      printf("/n/t/t/t〓〓〓〓〓图书管理系统〓〓〓〓〓/n/n");
      printf("请输入会员名字:");
      scanf("%s",name);
      printf("请输入会员性别:");
      scanf("%s",sex);
      printf("请输入会员学号:");
      scanf("%d",&xuehao);
      printf("/n");
      struct club *ptr_c;
      for(ptr_c=head_club;ptr_c;ptr_c=ptr_c->club_next)
      {
      if(ptr_c->xuehao==xuehao)
      {
        printf("此学号会员已存在/n");
        n=0;
        break;
      }
      }
    if(n){
      p_club=(struct club *)malloc(sizeof(struct club));
      strcpy(p_club->name,name);
      strcpy(p_club->sex,sex);
      p_club->xuehao=xuehao;
      strcpy(p_club->borrow,"暂无");
      head_club=Insert_Club(head_club,p_club);
      printf("/n添加会员成功!/n/n");
    }
      break;
    case 9:
      system("cls");
      printf("/n/t/t/t〓〓〓〓〓图书管理系统〓〓〓〓〓/n/n");
      printf("输入要删除会员学号:/n");
      scanf("%d",&xuehao);
      head_club=Delete_Club(head_club,xuehao);
      printf("/n删除会员成功!/n/n");
      break;
    case 10:
      system("cls");
      printf("/n/t/t/t〓〓〓〓〓图书管理系统〓〓〓〓〓/n/n");
      Print_Club(head_club);
      break;
    case 0:
      system("cls");
      printf("/n/t/t/t〓〓〓〓〓图书管理系统〓〓〓〓〓/n/n");
      printf("/n谢谢您的使用!/n/n");
      break;
    }
  }while(choice!=0);
   
  return 0;
}
struct book *Create_New_Book()
{
  struct book *head_book,*p_book;
  int bianhao;
  double price;
  char book_name[30],author[20];
  int size_book=sizeof(struct book);
   
  head_book=NULL;
  printf("请输入图书名称:");
  scanf("%s",book_name);
  printf("请输入图书编号:");
  scanf("%d",&bianhao);
  printf("请输入单价:");
  scanf("%lf",&price);
  printf("请输入作者名字:");
  scanf("%s",author);
  printf("/n");  
  while(bianhao!=0){
    p_book=(struct book *)malloc(size_book);
    strcpy(p_book->book_name,book_name);
    p_book->bianhao=bianhao;
    p_book->price=price;
    p_book->xuehao=0;
    strcpy(p_book->author,author);
    strcpy(p_book->state,"存在");
    strcpy(p_book->sex,"待定");
    strcpy(p_book->name,"待定");
    head_book=Insert_Book(head_book,p_book);  
    printf("请输入图书名称:");
    scanf("%s",book_name);
    printf("请输入图书编号:");
    scanf("%d",&bianhao);
    printf("请输入单价:");
    scanf("%lf",&price);
    printf("请输入作者名字:");
    scanf("%s",author);
    printf("/n");
  }
   
  return head_book;
}
struct book *Search_Book_bianhao(int bianhao,struct book *head_book)
{
  struct book *ptr_book;
  int flag=0;
  for(ptr_book=head_book;ptr_book;ptr_book=ptr_book->book_next)
  {
    if(ptr_book->bianhao==bianhao){
      printf("图书编号:%d/n",ptr_book->bianhao);
      printf("图书名称:%s/n",ptr_book->book_name);
      printf("图书单价:%.2lf/n",ptr_book->price);
      printf("图书作者:%s/n",ptr_book->author);
      printf("存在状态:%s/n",ptr_book->state);
      printf("借书人姓名:%s/n",ptr_book->name);
      printf("借书人性别:%s/n",ptr_book->sex);
      printf("学号:%d/n",ptr_book->xuehao);
      printf("/n");
      flag++;
    }
    }
  if(flag==0){
      printf("暂无此图书信息!/n/n");
  }
  return head_book;
}
struct book *Search_Book_name(char *b_name,struct book *head_book)
{
  struct book *ptr_book;
  int flag=0;
  for(ptr_book=head_book;ptr_book;ptr_book=ptr_book->book_next)
  {
    if(strcmp(ptr_book->book_name,b_name)==0){
      printf("图书编号:%d/n",ptr_book->bianhao);
      printf("图书名称:%s/n",ptr_book->book_name);
      printf("图书单价:%.2lf/n",ptr_book->price);
      printf("图书作者:%s/n",ptr_book->author);
      printf("存在状态:%s/n",ptr_book->state);
      printf("借书人姓名:%s/n",ptr_book->name);
      printf("借书人性别:%s/n",ptr_book->sex);
      printf("学号:%d/n",ptr_book->xuehao);
      printf("/n");
      flag++;
    }
    }
  if(flag==0){
      printf("暂无此图书信息!/n/n");
  }
  return head_book;
}
struct book *Search_Book_price(double price_h,double price_l,struct book *head_book)
{
  struct book *ptr_book;
  int flag=0;
  for(ptr_book=head_book;ptr_book;ptr_book=ptr_book->book_next)
  {
    if((ptr_book->price>=price_l)&&(ptr_book->price<=price_h)){
      printf("图书编号:%d/n",ptr_book->bianhao);
      printf("图书名称:%s/n",ptr_book->book_name);
      printf("图书单价:%.2lf/n",ptr_book->price);
      printf("图书作者:%s/n",ptr_book->author);
      printf("存在状态:%s/n",ptr_book->state);
      printf("借书人姓名:%s/n",ptr_book->name);
      printf("借书人性别:%s/n",ptr_book->sex);
      printf("学号:%d/n",ptr_book->xuehao);
      printf("/n");
      flag++;
    }
    }
  if(flag==0){
      printf("暂无此图书信息!/n/n");
  }
  return head_book;
}
struct book *Delete_Book(struct book *head_book,int bianhao)
{
  struct book *ptr1_book,*ptr2_book;
   
  while(head_book!=NULL && head_book->bianhao==bianhao){
    ptr2_book=head_book;
    head_book=head_book->book_next;
    free(ptr2_book);
  }
  if(head_book==NULL)
    return NULL;
   
  ptr1_book=head_book;
  ptr2_book=head_book->book_next;
  while(ptr2_book!=NULL){
    if(ptr2_book->bianhao==bianhao){
      ptr1_book->book_next=ptr2_book->book_next;
      free(ptr2_book);
    }
    else
      ptr1_book=ptr2_book;
    ptr2_book=ptr1_book->book_next;
  }
   
  return head_book;
}
struct club *Create_New_Club()
{
  struct club *head_club,*p_club;
  int xuehao;
  char name[20],sex[10];
  int size_club=sizeof(struct club);
   
  head_club=NULL;
  printf("请输入会员名字:");
  scanf("%s",name);
  printf("请输入会员性别:");
  scanf("%s",sex);
  printf("请输入会员学号:");
  scanf("%d",&xuehao);
  printf("/n");
   
  while(xuehao!=0){
    p_club=(struct club *)malloc(size_club);
    strcpy(p_club->name,name);
    strcpy(p_club->sex,sex);
    p_club->xuehao=xuehao;
    strcpy(p_club->borrow,"暂无");
     
    head_club=Insert_Club(head_club,p_club);
     
    printf("请输入会员名字:");
    scanf("%s",name);
    printf("请输入会员性别:");
    scanf("%s",sex);
    printf("请输入会员学号:");
    scanf("%d",&xuehao);
    printf("/n");
  }
   
  return head_club;
}
struct club *Search_Club_xuehao(int xuehao,struct club *head_club)
{
  struct club *ptr_club;
  int flag=0;
  for(ptr_club=head_club;ptr_club;ptr_club=ptr_club->club_next)
  {
    if(ptr_club->xuehao==xuehao){
      printf("会员姓名:%s/n",ptr_club->name);
      printf("会员性别:%s/n",ptr_club->sex);
      printf("会员学号:%d/n",ptr_club->xuehao);
      printf("所借图书:%s/n",ptr_club->borrow);
      printf("/n");
      flag++;
    }
    }
  if(flag==0){
      printf("此用户不存在!/n/n");
  }
  return head_club;
}
struct club *Search_Club_name(char *c_name,struct club *head_club)
{
  struct club *ptr_club;
  int flag=0;
  for(ptr_club=head_club;ptr_club;ptr_club=ptr_club->club_next)
  {
    if(strcmp(ptr_club->name,c_name)==0){
      printf("会员姓名:%s/n",ptr_club->name);
      printf("会员性别:%s/n",ptr_club->sex);
      printf("会员学号:%d/n",ptr_club->xuehao);
      printf("所借图书:%s/n",ptr_club->borrow);
      printf("/n");
      flag++;
    }
    }
  if(flag==0){
      printf("此用户不存在!/n/n");
  }
  return head_club;
}
struct book *Lent_Book(int bianhao,int xuehao,struct book *head_book,struct club *head_club)
{
  struct book *ptr_book;
  struct club *ptr_club;
  int flag=0;
   
  for(ptr_book=head_book;ptr_book;ptr_book=ptr_book->book_next)
    for(ptr_club=head_club;ptr_club;ptr_club=ptr_club->club_next)
    {
      if((ptr_book->bianhao==bianhao)&&(ptr_club->xuehao==xuehao))
      {
        strcpy(ptr_book->name,ptr_club->name);  /*字符串的复制,把右边的内容复制到左边*/
        strcpy(ptr_book->sex,ptr_club->sex);
        ptr_book->xuehao=ptr_club->xuehao;
        strcpy(ptr_book->state,"暂无");
        strcpy(ptr_club->borrow,ptr_book->book_name);
        flag++;
      }
      if(flag==0){
        printf("暂无此图书或您还未注册为会员!/n/n");
      }
    }
     
    return head_book;
}
struct book *back(int bianhao,int xuehao,struct book *head_book,struct club *head_club)
{
  struct book *ptr_book;
  struct club *ptr_club;
  int flag=0;
   
  for(ptr_book=head_book;ptr_book;ptr_book=ptr_book->book_next)
    for(ptr_club=head_club;ptr_club;ptr_club=ptr_club->club_next)
    {
      if((ptr_book->bianhao==bianhao) && (ptr_club->xuehao==xuehao))
      {
        strcpy(ptr_book->name,"暂无");
        strcpy(ptr_book->sex,"待定");
        ptr_book->xuehao=0;
        strcpy(ptr_book->state,"暂无");
        strcpy(ptr_club->borrow,"暂无");
        flag++;
      }
      if(flag==0){
        printf("输入有误,请重试/n/n");
      }
    }
     
    return head_book;
}
struct book *Insert_Book(struct book *head_book,struct book *stud_book)
{
  struct book *ptr_b,*ptr1_b,*ptr2_b;
  ptr2_b=head_book;
  ptr_b=stud_book;
  if(head_book==NULL){
    head_book=ptr_b;
    head_book->book_next=NULL;
  }
  else{
    while((ptr_b->bianhao > ptr2_b->bianhao) && (ptr2_b->book_next!=NULL)){
      ptr1_b=ptr2_b;
      ptr2_b=ptr2_b->book_next;
    }
    if(ptr_b->bianhao <= ptr2_b->bianhao){
      if(head_book==ptr2_b) head_book=ptr_b;
      else ptr1_b->book_next=ptr_b;
      ptr_b->book_next=ptr2_b;
    }
    else{
      ptr2_b->book_next=ptr_b;
      ptr_b->book_next=NULL;
    }
  }
  return head_book;
}
struct club *Insert_Club(struct club *head_club,struct club *stud_club)
{
  struct club *ptr_c,*ptr1_c,*ptr2_c;
  ptr2_c=head_club;
  ptr_c=stud_club;
  if(head_club==NULL){
    head_club=ptr_c;
    head_club->club_next=NULL;
  }
  else{
    while((ptr_c->xuehao > ptr2_c->xuehao) && (ptr2_c->club_next!=NULL)){
      ptr1_c=ptr2_c;
      ptr2_c=ptr2_c->club_next;
    }
    if(ptr_c->xuehao <= ptr2_c->xuehao){
      if(head_club==ptr2_c) head_club=ptr_c;
      else ptr1_c->club_next=ptr_c;
      ptr_c->club_next=ptr2_c;
    }
    else{
      ptr2_c->club_next=ptr_c;
      ptr_c->club_next=NULL;
    }
  }
  return head_club;
}
void Print_Club(struct club *head_club)
{
  struct club *ptr_c;
  if(head_club==NULL){
    printf("/n无记录/n/n");
    return;
  }
  printf("/n会员姓名/t会员性别/t会员学号/n/n");
  for(ptr_c=head_club;ptr_c;ptr_c=ptr_c->club_next)
    printf("%s/t/t%s/t/t%d/n",ptr_c->name,ptr_c->sex,ptr_c->xuehao);
}
struct club *Delete_Club(struct club *head_club,int xuehao)
{
  struct club *ptr1_club,*ptr2_club;
   
  while(head_club!=NULL && head_club->xuehao==xuehao){
    ptr2_club=head_club;
    head_club=head_club->club_next;
    free(ptr2_club);
  }
  if(head_club==NULL)
    return NULL;
   
  ptr1_club=head_club;
  ptr2_club=head_club->club_next;
  while(ptr2_club!=NULL){
    if(ptr2_club->xuehao==xuehao){
      ptr1_club->club_next=ptr2_club->club_next;
      free(ptr2_club);
    }
    else
      ptr1_club=ptr2_club;
    ptr2_club=ptr1_club->club_next;
  }
   
  return head_club;
}
void Print_Book(struct book *head_book)
{
  struct book *ptr_b;
  if(head_book==NULL){
    printf("/n无记录/n/n");
    return;
  }
  printf("/n图书编号/t图书名称/t图书单价/t图书作者/n/n");
  for(ptr_b=head_book;ptr_b;ptr_b=ptr_b->book_next)
    printf("%d/t/t%s/t/t%.2lf/t/t%s/n/n",ptr_b->bianhao,ptr_b->book_name,ptr_b->price,ptr_b->author);
}

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持服务器之家。

原文链接:http://blog.csdn.net/iamskying/article/details/4496437

延伸 · 阅读

精彩推荐