最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

C語(yǔ)言圖書(shū)管理系統(tǒng)課程設(shè)計(jì)

 更新時(shí)間:2018年01月12日 11:37:35   作者:iamskying  
這篇文章主要為大家詳細(xì)介紹了C語(yǔ)言圖書(shū)管理系統(tǒng)課程設(shè)計(jì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

這是本人大一第二學(xué)期初C語(yǔ)言課程設(shè)計(jì)的作品,嘿嘿,本來(lái)以為已經(jīng)找不到原稿了,今天無(wú)意中竟然在QQ網(wǎng)絡(luò)硬盤(pán)中找到了當(dāng)初的teta版,發(fā)布于此,以作紀(jì)念。

C

源代碼如下:

#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);/*瀏覽所有圖書(shū)信息*/ 
void Print_Club(struct club *head_club);/*瀏覽所有會(huì)員信息*/ 
struct book *Create_New_Book();/*創(chuàng)建新的圖書(shū)庫(kù),圖書(shū)編號(hào)輸入為0時(shí)結(jié)束*/ 
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);/*增加圖書(shū),逐個(gè)添加*/ 
struct book *Delete_Book(struct book *head_book,int bianhao);/*刪除圖書(shū)*/ 
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歡迎您第一次進(jìn)入圖書(shū)管理系統(tǒng)!/n/n"); 
  printf("----->[向?qū)----->[新建圖書(shū)庫(kù)]/n/n"); 
  printf("注意:當(dāng)輸入圖書(shū)編號(hào)為0時(shí),進(jìn)入下一步./n/n"); 
  head_book=Create_New_Book(); 
  system("cls"); 
  printf("/n歡迎您第一次進(jìn)入圖書(shū)管理系統(tǒng)!/n/n"); 
  printf("----->[向?qū)----->[新建會(huì)員庫(kù)]/n/n"); 
  printf("注意:當(dāng)輸入會(huì)員學(xué)號(hào)為0時(shí),進(jìn)入主菜單./n/n"); 
  head_club=Create_New_Club(); 
  system("cls"); 
  do{  
    printf("/n/t/t/t〓〓〓〓〓圖書(shū)管理系統(tǒng)〓〓〓〓〓/n/n"); 
    printf("/n"); 
    printf("/t/t/t[1]:借書(shū)辦理/t");printf(" [6]:還書(shū)辦理/n"); 
    printf("/n"); 
    printf("/t/t/t[2]:查詢(xún)圖書(shū)/t");printf(" [7]:查詢(xún)會(huì)員/n"); 
    printf("/t/t/t[3]:添加圖書(shū)/t");printf(" [8]:添加會(huì)員/n"); 
    printf("/t/t/t[4]:刪除圖書(shū)/t");printf(" [9]:刪除會(huì)員/n"); 
    printf("/t/t/t[5]:遍歷圖書(shū)/t");printf("[10]:遍歷會(huì)員/n/n"); 
    printf("/t/t/t〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓/n/n"); 
    printf("/t/t/t0:退出/n/n"); 
    printf("請(qǐng)選擇<0~10>:"); 
    scanf("%d",&choice); 
    switch(choice){ 
    case 1: 
      printf("/n/t/t/t〓〓〓〓〓圖書(shū)管理系統(tǒng)〓〓〓〓〓/n/n"); 
      printf("輸入所借圖書(shū)編號(hào):/n"); 
      scanf("%d",&bianhao); 
      printf("輸入借書(shū)人的學(xué)號(hào):/n"); 
      scanf("%d",&xuehao); 
      head_book=Lent_Book(bianhao,xuehao,head_book,head_club); 
      system("cls"); 
      printf("/n借閱成功!/n/n"); 
      printf("相關(guān)信息如下:/n/n"); 
      head_book=Search_Book_bianhao(bianhao,head_book); 
      break; 
    case 2: 
      system("cls"); 
      printf("/n/t/t/t〓〓〓〓〓圖書(shū)管理系統(tǒng)〓〓〓〓〓/n/n"); 
      printf("1.按編號(hào)查詢(xún)/n/n"); 
      printf("2.按名稱(chēng)查詢(xún)/n/n"); 
      printf("3.按價(jià)格區(qū)間查詢(xún)/n/n"); 
      printf("0.返回主菜單/n/n"); 
      printf("請(qǐng)選擇:"); 
      scanf("%d",&f); 
      if(f==1){ 
        printf("請(qǐng)輸入查詢(xún)圖書(shū)編號(hào):"); 
        scanf("%d",&bianhao); 
        printf("相關(guān)信息如下:/n/n"); 
        head_book=Search_Book_bianhao(bianhao,head_book); 
        break; 
      } 
      else if(f==2){ 
        b_name=book_name; 
        getchar(); 
        printf("請(qǐng)輸入查詢(xún)圖書(shū)名稱(chēng):"); 
        gets(b_name); 
        printf("相關(guān)信息如下:/n/n"); 
        head_book=Search_Book_name(b_name,head_book); 
        break; 
      } 
      else if(f==3){ 
        printf("請(qǐng)輸入最高價(jià)格:"); 
        scanf("%lf",&price_h); 
        printf("請(qǐng)輸入最低價(jià)格:"); 
        scanf("%lf",&price_l); 
        printf("相關(guān)信息如下:/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〓〓〓〓〓圖書(shū)管理系統(tǒng)〓〓〓〓〓/n/n"); 
      printf("輸入所還圖書(shū)編號(hào):/n"); 
      scanf("%d",&bianhao); 
      printf("輸入還書(shū)人的學(xué)號(hào):/n"); 
      scanf("%d",&xuehao); 
      head_book=back(bianhao,xuehao,head_book,head_club); 
      system("cls"); 
      printf("/n歸還成功!/n/n"); 
      printf("相關(guān)信息如下:/n/n"); 
      head_book=Search_Book_bianhao(bianhao,head_book); 
      break; 
    case 3: 
      system("cls"); 
      printf("/n/t/t/t〓〓〓〓〓圖書(shū)管理系統(tǒng)〓〓〓〓〓/n/n"); 
      printf("請(qǐng)輸入圖書(shū)名稱(chēng):"); 
      scanf("%s",book_name); 
      printf("請(qǐng)輸入圖書(shū)編號(hào):"); 
      scanf("%d",&bianhao); 
      printf("請(qǐng)輸入單價(jià):"); 
      scanf("%lf",&price); 
      printf("請(qǐng)輸入作者名字:"); 
      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("此編號(hào)圖書(shū)已存在/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添加圖書(shū)成功!/n/n"); 
      } 
      break; 
    case 4: 
      system("cls"); 
      printf("/n/t/t/t〓〓〓〓〓圖書(shū)管理系統(tǒng)〓〓〓〓〓/n/n"); 
      printf("輸入刪除圖書(shū)編號(hào):/n"); 
      scanf("%d",&bianhao); 
      head_book=Delete_Book(head_book,bianhao); 
      printf("/n刪除圖書(shū)成功!/n/n"); 
      break; 
    case 5: 
      system("cls"); 
      printf("/n/t/t/t〓〓〓〓〓圖書(shū)管理系統(tǒng)〓〓〓〓〓/n/n"); 
      Print_Book(head_book); 
      break; 
    case 7: 
      system("cls"); 
      printf("/n/t/t/t〓〓〓〓〓圖書(shū)管理系統(tǒng)〓〓〓〓〓/n/n"); 
      printf("1.按學(xué)號(hào)查詢(xún)/n/n"); 
      printf("2.按姓名查詢(xún)/n/n"); 
      printf("0.返回主菜單/n/n"); 
      printf("請(qǐng)選擇:"); 
      scanf("%d",&f); 
      if(f==1){ 
        printf("請(qǐng)輸入查詢(xún)會(huì)員學(xué)號(hào):"); 
        scanf("%d",&xuehao); 
        printf("相關(guān)信息如下:/n/n"); 
        head_club=Search_Club_xuehao(xuehao,head_club); 
        break; 
      } 
      else if(f==2){ 
        c_name=name; 
        getchar(); 
        printf("請(qǐng)輸入查詢(xún)會(huì)員姓名:"); 
        gets(c_name); 
        printf("相關(guān)信息如下:/n/n"); 
        head_club=Search_Club_name(c_name,head_club); 
        break; 
      } 
      else if(f==0){ 
        break; 
      } 
      break; 
      printf("請(qǐng)輸入查詢(xún)會(huì)員學(xué)號(hào):/n"); 
      scanf("%d",&xuehao); 
      printf("相關(guān)信息如下:/n/n"); 
       
      break; 
    case 8: 
      system("cls"); 
      printf("/n/t/t/t〓〓〓〓〓圖書(shū)管理系統(tǒng)〓〓〓〓〓/n/n"); 
      printf("請(qǐng)輸入會(huì)員名字:"); 
      scanf("%s",name); 
      printf("請(qǐng)輸入會(huì)員性別:"); 
      scanf("%s",sex); 
      printf("請(qǐng)輸入會(huì)員學(xué)號(hào):"); 
      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("此學(xué)號(hào)會(huì)員已存在/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,"暫無(wú)"); 
      head_club=Insert_Club(head_club,p_club); 
      printf("/n添加會(huì)員成功!/n/n"); 
    } 
      break; 
    case 9: 
      system("cls"); 
      printf("/n/t/t/t〓〓〓〓〓圖書(shū)管理系統(tǒng)〓〓〓〓〓/n/n"); 
      printf("輸入要?jiǎng)h除會(huì)員學(xué)號(hào):/n"); 
      scanf("%d",&xuehao); 
      head_club=Delete_Club(head_club,xuehao); 
      printf("/n刪除會(huì)員成功!/n/n"); 
      break; 
    case 10: 
      system("cls"); 
      printf("/n/t/t/t〓〓〓〓〓圖書(shū)管理系統(tǒng)〓〓〓〓〓/n/n"); 
      Print_Club(head_club); 
      break; 
    case 0: 
      system("cls"); 
      printf("/n/t/t/t〓〓〓〓〓圖書(shū)管理系統(tǒng)〓〓〓〓〓/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("請(qǐng)輸入圖書(shū)名稱(chēng):"); 
  scanf("%s",book_name); 
  printf("請(qǐng)輸入圖書(shū)編號(hào):"); 
  scanf("%d",&bianhao); 
  printf("請(qǐng)輸入單價(jià):"); 
  scanf("%lf",&price); 
  printf("請(qǐng)輸入作者名字:"); 
  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("請(qǐng)輸入圖書(shū)名稱(chēng):"); 
    scanf("%s",book_name); 
    printf("請(qǐng)輸入圖書(shū)編號(hào):"); 
    scanf("%d",&bianhao); 
    printf("請(qǐng)輸入單價(jià):"); 
    scanf("%lf",&price); 
    printf("請(qǐng)輸入作者名字:"); 
    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("圖書(shū)編號(hào):%d/n",ptr_book->bianhao); 
      printf("圖書(shū)名稱(chēng):%s/n",ptr_book->book_name); 
      printf("圖書(shū)單價(jià):%.2lf/n",ptr_book->price); 
      printf("圖書(shū)作者:%s/n",ptr_book->author); 
      printf("存在狀態(tài):%s/n",ptr_book->state); 
      printf("借書(shū)人姓名:%s/n",ptr_book->name); 
      printf("借書(shū)人性別:%s/n",ptr_book->sex); 
      printf("學(xué)號(hào):%d/n",ptr_book->xuehao); 
      printf("/n"); 
      flag++; 
    } 
    } 
  if(flag==0){ 
      printf("暫無(wú)此圖書(shū)信息!/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("圖書(shū)編號(hào):%d/n",ptr_book->bianhao); 
      printf("圖書(shū)名稱(chēng):%s/n",ptr_book->book_name); 
      printf("圖書(shū)單價(jià):%.2lf/n",ptr_book->price); 
      printf("圖書(shū)作者:%s/n",ptr_book->author); 
      printf("存在狀態(tài):%s/n",ptr_book->state); 
      printf("借書(shū)人姓名:%s/n",ptr_book->name); 
      printf("借書(shū)人性別:%s/n",ptr_book->sex); 
      printf("學(xué)號(hào):%d/n",ptr_book->xuehao); 
      printf("/n"); 
      flag++; 
    } 
    } 
  if(flag==0){ 
      printf("暫無(wú)此圖書(shū)信息!/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("圖書(shū)編號(hào):%d/n",ptr_book->bianhao); 
      printf("圖書(shū)名稱(chēng):%s/n",ptr_book->book_name); 
      printf("圖書(shū)單價(jià):%.2lf/n",ptr_book->price); 
      printf("圖書(shū)作者:%s/n",ptr_book->author); 
      printf("存在狀態(tài):%s/n",ptr_book->state); 
      printf("借書(shū)人姓名:%s/n",ptr_book->name); 
      printf("借書(shū)人性別:%s/n",ptr_book->sex); 
      printf("學(xué)號(hào):%d/n",ptr_book->xuehao); 
      printf("/n"); 
      flag++; 
    } 
    } 
  if(flag==0){ 
      printf("暫無(wú)此圖書(shū)信息!/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("請(qǐng)輸入會(huì)員名字:"); 
  scanf("%s",name); 
  printf("請(qǐng)輸入會(huì)員性別:"); 
  scanf("%s",sex); 
  printf("請(qǐng)輸入會(huì)員學(xué)號(hào):"); 
  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,"暫無(wú)"); 
     
    head_club=Insert_Club(head_club,p_club); 
     
    printf("請(qǐng)輸入會(huì)員名字:"); 
    scanf("%s",name); 
    printf("請(qǐng)輸入會(huì)員性別:"); 
    scanf("%s",sex); 
    printf("請(qǐng)輸入會(huì)員學(xué)號(hào):"); 
    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("會(huì)員姓名:%s/n",ptr_club->name); 
      printf("會(huì)員性別:%s/n",ptr_club->sex); 
      printf("會(huì)員學(xué)號(hào):%d/n",ptr_club->xuehao); 
      printf("所借圖書(shū):%s/n",ptr_club->borrow); 
      printf("/n"); 
      flag++; 
    } 
    } 
  if(flag==0){ 
      printf("此用戶(hù)不存在!/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("會(huì)員姓名:%s/n",ptr_club->name); 
      printf("會(huì)員性別:%s/n",ptr_club->sex); 
      printf("會(huì)員學(xué)號(hào):%d/n",ptr_club->xuehao); 
      printf("所借圖書(shū):%s/n",ptr_club->borrow); 
      printf("/n"); 
      flag++; 
    } 
    } 
  if(flag==0){ 
      printf("此用戶(hù)不存在!/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);  /*字符串的復(fù)制,把右邊的內(nèi)容復(fù)制到左邊*/ 
        strcpy(ptr_book->sex,ptr_club->sex); 
        ptr_book->xuehao=ptr_club->xuehao; 
        strcpy(ptr_book->state,"暫無(wú)"); 
        strcpy(ptr_club->borrow,ptr_book->book_name); 
        flag++; 
      } 
      if(flag==0){ 
        printf("暫無(wú)此圖書(shū)或您還未注冊(cè)為會(huì)員!/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,"暫無(wú)"); 
        strcpy(ptr_book->sex,"待定"); 
        ptr_book->xuehao=0; 
        strcpy(ptr_book->state,"暫無(wú)"); 
        strcpy(ptr_club->borrow,"暫無(wú)"); 
        flag++; 
      } 
      if(flag==0){ 
        printf("輸入有誤,請(qǐng)重試/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無(wú)記錄/n/n"); 
    return; 
  } 
  printf("/n會(huì)員姓名/t會(huì)員性別/t會(huì)員學(xué)號(hào)/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無(wú)記錄/n/n"); 
    return; 
  } 
  printf("/n圖書(shū)編號(hào)/t圖書(shū)名稱(chēng)/t圖書(shū)單價(jià)/t圖書(shū)作者/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); 
}

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • 基于C語(yǔ)言實(shí)現(xiàn)三子棋小游戲

    基于C語(yǔ)言實(shí)現(xiàn)三子棋小游戲

    這篇文章主要為大家詳細(xì)介紹了基于C語(yǔ)言實(shí)現(xiàn)三子棋小游戲,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2021-11-11
  • C++中fstream,ifstream及ofstream用法淺析

    C++中fstream,ifstream及ofstream用法淺析

    這篇文章主要介紹了C++中fstream,ifstream及ofstream用法,適合C++初學(xué)者學(xué)習(xí)文件流的操作,需要的朋友可以參考下
    2014-08-08
  • C語(yǔ)言實(shí)現(xiàn)簡(jiǎn)單掃雷小游戲

    C語(yǔ)言實(shí)現(xiàn)簡(jiǎn)單掃雷小游戲

    這篇文章主要為大家詳細(xì)介紹了C語(yǔ)言實(shí)現(xiàn)簡(jiǎn)單掃雷小游戲,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2019-10-10
  • qt實(shí)現(xiàn)倒計(jì)時(shí)示例

    qt實(shí)現(xiàn)倒計(jì)時(shí)示例

    這篇文章主要介紹了qt實(shí)現(xiàn)倒計(jì)時(shí)示例,需要的朋友可以參考下
    2014-05-05
  • Opencv圖像處理之圖像增加邊框

    Opencv圖像處理之圖像增加邊框

    這篇文章主要為大家詳細(xì)介紹了Opencv圖像處理之圖像增加邊框,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2018-10-10
  • Qt使用TabWidget實(shí)現(xiàn)多窗體功能

    Qt使用TabWidget實(shí)現(xiàn)多窗體功能

    Qt 是一個(gè)跨平臺(tái)C++圖形界面開(kāi)發(fā)庫(kù),利用Qt可以快速開(kāi)發(fā)跨平臺(tái)窗體應(yīng)用程序,在Qt中我們可以通過(guò)拖拽的方式將不同組件放到指定的位置,本章將重點(diǎn)介紹TabWidget標(biāo)簽組件的常用方法及靈活運(yùn)用,需要的朋友可以參考下
    2023-12-12
  • C++ 數(shù)據(jù)結(jié)構(gòu)之水洼的數(shù)量算法

    C++ 數(shù)據(jù)結(jié)構(gòu)之水洼的數(shù)量算法

    這篇文章主要介紹了C++ 數(shù)據(jù)結(jié)構(gòu)之水洼的數(shù)量算法的相關(guān)資料,需要的朋友可以參考下
    2017-06-06
  • C語(yǔ)言操作符基礎(chǔ)知識(shí)圖文詳解

    C語(yǔ)言操作符基礎(chǔ)知識(shí)圖文詳解

    這篇文章主要以圖文結(jié)合的方式為大家詳細(xì)介紹了C語(yǔ)言位運(yùn)算基礎(chǔ)知識(shí),感興趣的小伙伴們可以參考一下,希望能給你帶來(lái)幫助
    2021-08-08
  • C++程序函數(shù)的重載和函數(shù)模板示例代碼

    C++程序函數(shù)的重載和函數(shù)模板示例代碼

    C++允許在同一作用域中用同一函數(shù)名定義多個(gè)函數(shù),這些函數(shù)的參數(shù)個(gè)數(shù)和參數(shù)類(lèi)型不相同,這些同名的函數(shù)用來(lái)實(shí)現(xiàn)不同的功能,這就是函數(shù)的重載,這篇文章主要介紹了C++程序函數(shù)的重載和函數(shù)模板,需要的朋友可以參考下
    2024-03-03
  • 淺析順序結(jié)構(gòu)存儲(chǔ)的棧

    淺析順序結(jié)構(gòu)存儲(chǔ)的棧

    這篇文章主要介紹了順序結(jié)構(gòu)存儲(chǔ)的棧,有需要的朋友可以參考一下
    2014-01-01

最新評(píng)論

鄂伦春自治旗| 东源县| 永新县| 广灵县| 沁源县| 黄大仙区| 武安市| 桓仁| 卢龙县| 巫溪县| 江陵县| 英德市| 朝阳县| 屏东县| 疏勒县| 吴川市| 晋中市| 红河县| 延吉市| 武义县| 梁河县| 法库县| 德庆县| 蓬莱市| 阿瓦提县| 舞阳县| 慈溪市| 噶尔县| 南岸区| 新营市| 沂源县| 凤冈县| 怀宁县| 灌阳县| 晋城| 昌乐县| 台前县| 馆陶县| 锦州市| 大丰市| 闽清县|