亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? bookms.c

?? 是一個比較好的圖書管理系統
?? C
?? 第 1 頁 / 共 4 頁
字號:
    fputc('1', wfp);  /*寫入記錄狀態標志,1表示該記錄有效*/
    fwrite(cur_book_ptr, sizeof(struct BookNode), 1, wfp);  /*用數據塊寫入方式 */

    fclose(wfp);   /*關閉文件*/
    return;
}


/*****************************************************************/
/* add a new book to the pointer and save it to the data file   */

void Add_New_Book()   /*新添加一本書 */
{
   char c;
   int i, num, bookID, loop=0;
   struct BookNode* new_node_ptr; 
   char str[BKNAMESZ], instr[BKNAMESZ];
   char newBookID[BKIDSZ];
   new_node_ptr =
        (struct BookNode*)malloc(sizeof(struct BookNode));

   if(new_node_ptr != NULL)
   {
       /*自動分配新書號    */
      num = Alloc_NewID();
      bookID = num;
      /*將整形數字轉換成五個字符長的字符串,左端補0 */
      for(i=BKIDSZ-2; i>=0; i--)
      {
      newBookID[i] = num%10 + 48;
      num = num/10;
      }
      newBookID[BKIDSZ-1] = '\0';
      printf("new BookID: %s\n", newBookID);
      strcpy(new_node_ptr->bkID, newBookID);

      /*獲得書名 */
      printf("Please Input BookName(1~20 chars):\n");
      gets(instr);
      while(strlen(instr) > BKNAMESZ-1)
      {
      printf("Wrong input, it is too long!\n");
      printf("Please Input BookName(1~20 chars):\n");
      gets(instr);
      }
      sprintf(str, "%-20s", instr);
      strcpy(new_node_ptr->bkName, str);

      /*獲得作者   */
      printf("Please Input Book's writer(1~15 chars):\n");
      gets(instr);
      while(strlen(instr) > WRITERSZ-1)
      {
      printf("Wrong input, it is too long!\n");
      printf("Please Input Book's writer(1~15 chars):\n");
      gets(instr);
      }
      sprintf(str, "%-15s", instr);
      strcpy(new_node_ptr->writer, str);

      /*獲得出版社  */
      printf("Please Input Book's Press(1~15 chars):\n");
      gets(instr);
      while(strlen(instr) > PRESSSZ)
      {
      printf("Wrong input, it is too long!\n");
      printf("Please Input Book's Press(1~15 chars):\n");
      gets(instr);
      }
      sprintf(str, "%-15s", instr);
      strcpy(new_node_ptr->Press, str);

      /*獲得出版時間 */
      printf("Please Input Book's PubTime(like: 20020308):\n");
      gets(instr);
      loop = Assure_Time_True(instr);   /*檢測輸入的時間是否合法 */
      while(loop==-1)
      {
          printf("The time is wrong!\n");
          printf("Please Input Book's PubTime(like: 20020308):\n");
          gets(instr);
          loop = Assure_Time_True(instr);
      }
      sprintf(str, "%-8s", instr);
      strcpy(new_node_ptr->pubTime, str);
      
      /*新加入的書默認狀態為 在館 */
      new_node_ptr->curStatus = '0';
      strcpy(new_node_ptr->rdID, "*****");

      /*顯示新書信息  */
      Display_Record(new_node_ptr);
      cur_book_ptr = new_node_ptr;
      new_node_ptr = NULL;

      /*詢問是否添加該新書 */
      printf("Add this book? (y/n):");
      c = getch();
      printf("%c\n", c);
      if(c=='y'||c=='Y')
      {
          Save_cur_Book_Node();   /*將當前數目寫到文件*/

          free(cur_book_ptr);    /*釋放指針 */
          cur_book_ptr = NULL;
         
          if(bookID==book_record_Total)  /*若記錄是在最后插入的,則記錄總數應該加1*/
          {                       /*新插入點為最后*/
             book_record_Total++;
             book_newID_Position = book_record_Total;
          }
          else
          {
             book_newID_Position = bookID+1;
             book_delete_total--; /* 在中間插入一個新紀錄,則中間的無效記錄數目減一 */
          }

          Save_Book_Infor_Word();    /*保存信息字  */
          printf("Adding Successful!\n");         
      }
      else
      {
       printf("Adding Cancled!\n");
      }
      return;
   }
   else
   {
       printf("WARNING:Memory Error!\n");
       return;
   }

}


/***********************************************************/
/*  to allocate a new ID to the new reader automatically   */

int Alloc_NewID()
{
    int num;
    int result, i;

    if(book_newID_Position==book_record_Total) /*前面沒有空記錄,從后面依次分配*/
         num = book_newID_Position;

    /*存在空記錄,調用函數Search_Null_Record()搜索book_newID_Position后的*/
    /*第一條空記錄位置作為新數添加的位置  */
    else
    {
       result = Search_Null_Record();
       if(result < 0)
       {
           printf("Allocate newID Failed!\n");
           return -1;
       }
       else
           num = result;

    }
    return(num);
}


/**********************************************************************/
/*start from the book_newID_Position to search the ineffective record */

int Search_Null_Record()
{
    char ch;
    FILE *rfp;
    int  step;

    if((rfp=fopen("BookData.txt","r")) == NULL)
    {
        printf("Open File Error!\n");
        return -1;
    }

    printf("New_position:%d\n", book_newID_Position);

    step = book_newID_Position * (BKRECSIZE+1);
    step += (INFORSZ-1)*3;
    fseek(rfp, step, 0);
    ch = fgetc(rfp);     /*讀有效標志 */
    while((ch=='1')&&(book_newID_Position<book_record_Total))
    {
        printf("sss\n");
        book_newID_Position++;
        fseek(rfp, BKRECSIZE, 1);   /*跳過一條記錄*/
        ch = fgetc(rfp);   /*讀有效標志  */
    }
    fclose(rfp);

    return(book_newID_Position);
}


/******************************************************/
/* 簡單的檢驗輸入的時間是否合法   */

int Assure_Time_True(char *time_str)
{

    long num1, num2;
    int loop;
    int year, mon, day;
    char date_str[TIMESZ], mon_str[3], day_str[3];
    struct date *cur_date = (struct date*)malloc(sizeof(struct date));

    if(strlen(time_str) != TIMESZ-1)   /*時間錯誤(字符串長度不為8)*/
    return -1;

    num1 = atol(time_str);    /*該函數自動取字符串前面的數字串而舍去后面的非數字串 */
    if(num1>99999999 || num1<10000000)
    return -1;        /*時間錯誤(數字串長度不為8) */

    year = num1 / 10000;
    num2 = num1 % 10000;
    mon = num2 / 100;
    day = num2 % 100;
    if(mon==0 || day==0)
        return -1;

    if(mon > 12)
        return -1;      /*時間錯誤(月份不正確) */

    loop = Days_Per_Month(year, mon);
    if(day > loop) return -1;    /* 時間錯誤(比當前月份最大日期大)*/

    getdate(cur_date);
    sprintf(date_str, "%d", cur_date->da_year);
    sprintf(mon_str, "%d", cur_date->da_mon);
    sprintf(day_str, "%d", cur_date->da_day);
    if(cur_date->da_mon < 10)
    strcat(date_str, "0");
    strcat(date_str, mon_str);
    if(cur_date->da_day < 10)
    strcat(date_str, "0");
    strcat(date_str, day_str);
    date_str[TIMESZ-1] = '\0';
    if(strcmp(time_str, date_str) > 0)
        return -1;      /*時間錯誤(出版時間時間大于當前時間)*/

    return 1;
}


int Days_Per_Month(int year, int mon)
{
    int loop;

    if((!(year%4)&&(year%100)) || !(year%400))
    loop = 1;    /*閏年  */
    else
    loop = 0;    /*平年 */

    switch(mon)
    {
     case(1):
     case(3):
     case(5):
     case(7):
     case(8):
     case(10):
     case(12):
         return 31;
     case(4):
     case(6):
     case(9):
     case(11):
         return 30;
     case(2):
         if(loop) return 29;
         else return 28;
    }
}


/**************************************************/
/*   Search a book by different ways              */

void Search_Book()
{
    static char choice;   /* 此處很重要,因為Switch_Search_Reader()中default中*/
                          /* 遞歸調用了該函數,設置為static則遞歸調用時使用同一個 */
                          /* choice 變量,即只做一次處理,而且可以正確退出*/
    do
    {
      clrscr();
      printf("       Searching Menu \n");
      printf("1 - Search a book by a Book's ID\n");
      printf("2 - Search a book by book's fullname\n");
      printf("3 - Search a book by bookname's fisrt letter\n");
      printf("4 - Search a book by author's fullname\n");
      printf("5 - Search a book by Press's fullname\n");
      printf("ESC - Return\n");
      printf("Please input your choice:");
      choice = getch();
      printf("%c\n", choice);
      if(choice!=27)
          Switch_Search_Book(choice);
    }while(choice!=27);

    return;
}


/***********************************************/

void Switch_Search_Book(char c)
{
     switch(c)
     {
     case('1'):
         Search_By_BookID();
         break;
     case('2'):
         Search_By_Book_Fullname();
         break;
     case('3'):
         Search_By_First_Letter();
         break;
     case('4'):
         Search_By_Writer();
         break;
     case('5'):
         Search_By_Press();
         break;
     default:
         printf("Invalid choice\n");
         printf("Press any key to continue!\n");
         getch();
         Search_Book();
         break;
     }

     return;
}


/***************************************************/

void Search_By_BookID()
{
    int loop, num;
    char instr[BKIDSZ];

    num = Get_Book_ID();
    if(num==-1)   /* 操作取消 */
        return;

    Select_And_Display(num);

    return;
}


/*************************************************************/

void Search_By_Book_Fullname()
{
    int i, loop, match_total=0;
    char ch;
    char instr[BKNAMESZ], name_str[BKNAMESZ], temp_str[BKNAMESZ];
    printf("Please Input Book'Fullname(1~20 chars):\n");
    gets(instr);
    while(strlen(instr) > BKNAMESZ-1)
    {
        printf("Wrong input, it is too long!\n");
        printf("Please Input BookName(1~20 chars):\n");
        gets(instr);
    }
    sprintf(name_str, "%-20s", instr);

    clrscr();
    for(i=0; i<book_record_Total; i++)
    {
        loop = Load_Book_Record(i);
        if(loop != 1)
            continue;
        strcpy(temp_str, cur_book_ptr->bkName);
        loop = strcmp(strlwr(temp_str), strlwr(name_str));
        if(!loop)
        {
            match_total++;
            if(match_total % PAGESIZE==1)
            {
                clrscr();
                printf(" Number|        Name        |     Writer    |     Press     | Pub-Time |In-Lib\n");
                printf("-------------------------------------------------------------------------------\n");
            }
            Display_Record(cur_book_ptr);
            free(cur_book_ptr);
            cur_book_ptr = NULL;
            if(match_total % PAGESIZE==0)
            {
                printf("Press any key to the next page!\n");
                getch();
            }
        }
    }
    printf("\nThere are  %d  matching records!\n", match_total);
    if(match_total)
    {
        printf("Press P to continue, Press else key to return!\n");
        ch = getch();
        if(ch=='p'||ch=='P')
            Search_By_BookID();
        else
            return;
    }
    else
    {
        printf("Press any key to continue!\n");
        getch();
    }

    return;
}


/****************************************************************/

void Search_By_First_Letter()
{
    int i, loop, match_total=0;
    char ch, inch, tempch;
    char instr[BKNAMESZ], name_str[BKNAMESZ], temp_str[BKNAMESZ];
    printf("Please Input the first letter of the Book'name:\n");
    inch = getch();

    clrscr();
    for(i=0; i<book_record_Total; i++)
    {
        loop = Load_Book_Record(i);
        if(loop != 1)
            continue;
        tempch = cur_book_ptr->bkName[0];
        if(tolower(inch)==tolower(tempch))
        {
            match_total++;
            if(match_total % PAGESIZE==1)
            {
                clrscr();
                printf(" Number|        Name        |     Writer    |     Press     | Pub-Time |In-Lib\n");
                printf("-------------------------------------------------------------------------------\n");
            }
            Display_Record(cur_book_ptr);
            free(cur_book_ptr);
            cur_book_ptr = NULL;
            if(match_total % PAGESIZE==0)
            {
                printf("Press any key to the next page!\n");
                getch();
            }
        }
    }
    printf("\nThere are  %d  matching records!\n", match_total);
    if(match_total)
    {
        printf("Press P to continue, Press else key to return!\n");
        ch = getch();
        if(ch=='p'||ch=='P')
            Search_By_BookID();
        else
            return;
    }
    else
    {
        printf("Press any key to continue!\n");
        getch();
    }

    return;
}


/******************************************************/

void Search_By_Writer()
{
    int i, loop, match_total=0;
    char ch, instr[WRITERSZ], writer_str[WRITERSZ], temp_str[WRITERSZ];
    printf("Please Input Book'author's fullname(1~15 chars):\n");
    gets(instr);
    while(strlen(instr) > WRITERSZ-1)
    {
        printf("Wrong input, it is too long!\n");
        printf("Please Input Book'author's fullname(1~15 chars):\n");
        gets(instr);
    }
    sprintf(writer_str, "%-15s", instr);

    clrscr();
    for(i=0; i<book_record_Total; i++)
    {
        loop = Load_Book_Record(i);
        if(loop != 1)
            continue;
        strcpy(temp_str, cur_book_ptr->writer);
        loop = strcmp(strlwr(temp_str), strlwr(writer_str));
        if(!loop)
        {
            match_total++;
            if(match_total % PAGESIZE==1)
            {
                clrscr();
                printf(" Number|        Name        |     Writer    |     Press     | Pub-Time |In-Lib\n");
                printf("-------------------------------------------------------------------------------\n");
            }
            Display_Record(cur_book_ptr);
            free(cur_book_ptr);
            cur_book_ptr = NULL;
            if(match_total % PAGESIZE==0)
            {
                printf("Press any key to the next page!\n");
                getch();
            }
        }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美大黄免费观看| 欧美亚洲动漫精品| 久久久久久久久久电影| 国产一区二区三区av电影| 国产亚洲制服色| 成人午夜电影久久影院| 国产精品嫩草影院av蜜臀| 91麻豆国产在线观看| 亚洲与欧洲av电影| 日韩欧美在线影院| 国产成人亚洲精品狼色在线 | 欧美视频日韩视频在线观看| 中文字幕一区二区三区四区 | 狠狠v欧美v日韩v亚洲ⅴ| 久久精品视频网| 不卡的av网站| 午夜视频在线观看一区二区三区| 欧美一区二区三区四区久久| 国产精品自拍在线| 亚洲黄网站在线观看| 欧美一区二区三区四区高清 | 97se亚洲国产综合在线| 一级特黄大欧美久久久| 日韩欧美国产小视频| 成人免费视频caoporn| 亚洲国产精品久久一线不卡| 日韩午夜在线观看| 成年人国产精品| 秋霞午夜av一区二区三区| 中文字幕国产一区| 欧美一区二区三区四区视频| 不卡的av网站| 久久97超碰国产精品超碰| 亚洲欧美色一区| 2017欧美狠狠色| 欧美体内she精视频| 国产成人综合在线观看| 亚洲一区二区视频在线| 日本一区二区综合亚洲| 欧美日韩大陆一区二区| 不卡av在线网| 久久se精品一区精品二区| 综合婷婷亚洲小说| 久久色中文字幕| 欧美精品一二三| 99精品久久只有精品| 精品一区二区影视| 视频一区二区中文字幕| 最新中文字幕一区二区三区| 日韩欧美国产一二三区| 欧美欧美欧美欧美| 91久久精品一区二区三区| 国产白丝精品91爽爽久久 | 精品蜜桃在线看| 欧美日韩和欧美的一区二区| 97精品国产97久久久久久久久久久久| 另类的小说在线视频另类成人小视频在线 | 亚洲最大成人网4388xx| 国产精品欧美久久久久无广告| 日韩一区二区视频| 欧美丝袜丝交足nylons| 91久久精品一区二区| aaa欧美日韩| 菠萝蜜视频在线观看一区| 国产a区久久久| 国产成人三级在线观看| 国产中文一区二区三区| 精品一区二区在线播放| 免费观看日韩电影| 免费在线欧美视频| 日本午夜精品视频在线观看| 亚洲风情在线资源站| 一区二区三区在线视频播放| 亚洲人成网站色在线观看| 亚洲少妇30p| 亚洲女厕所小便bbb| 亚洲人被黑人高潮完整版| 亚洲欧洲日本在线| 亚洲美女少妇撒尿| 亚洲一区二区三区四区在线免费观看 | 不卡电影一区二区三区| 成人精品鲁一区一区二区| 国产精品一区二区三区99| 国产麻豆精品久久一二三| 国产在线精品一区二区| 国产成人综合在线播放| jvid福利写真一区二区三区| 91一区二区在线| 欧美日韩一卡二卡三卡| 欧美一区2区视频在线观看| 日韩精品中文字幕在线不卡尤物| 精品国产乱码久久| 国产午夜精品福利| 国产精品毛片高清在线完整版| **欧美大码日韩| 午夜精品免费在线| 韩国av一区二区| 成人激情图片网| 欧美性色黄大片| 日韩一区二区三区四区五区六区 | 中文字幕免费一区| 一区二区三区在线免费播放| 五月激情综合网| 国产乱码精品一区二区三区忘忧草 | 91在线云播放| 欧美日本免费一区二区三区| 欧美videofree性高清杂交| 国产日韩欧美不卡| 亚洲一区二区在线观看视频| 久色婷婷小香蕉久久| 99re视频精品| 欧美精品一二三| 中文字幕不卡的av| 亚洲国产精品一区二区尤物区| 日本成人在线电影网| 国产成人av一区二区三区在线观看| 99riav一区二区三区| 日韩欧美国产一区二区在线播放| 国产精品久久免费看| 奇米888四色在线精品| 99精品视频在线免费观看| 欧美一区二区三区喷汁尤物| 亚洲欧美在线高清| 丝袜美腿亚洲综合| 99re66热这里只有精品3直播| 91麻豆精品国产91久久久久久 | 7777女厕盗摄久久久| 国产精品国产三级国产有无不卡| 日本亚洲欧美天堂免费| 99精品欧美一区二区三区综合在线| 日韩三级视频在线看| 亚洲精品成人a在线观看| 国产福利一区二区三区视频| 欧美久久久久久久久| 亚洲天天做日日做天天谢日日欢 | 成人午夜免费电影| 日韩欧美亚洲国产精品字幕久久久 | 欧美日韩免费一区二区三区| 国产亚洲欧美在线| 裸体健美xxxx欧美裸体表演| 欧美写真视频网站| 日韩理论在线观看| 懂色一区二区三区免费观看| 日韩精品资源二区在线| 五月天欧美精品| 色老头久久综合| 成人欧美一区二区三区视频网页 | 99久久精品久久久久久清纯| 欧美成人伊人久久综合网| 午夜精品久久久久久久久久| 日本道色综合久久| 亚洲欧美日韩中文字幕一区二区三区| 国产一区二区中文字幕| 日韩欧美亚洲另类制服综合在线| 亚洲一级不卡视频| 色偷偷成人一区二区三区91| 国产精品国产自产拍高清av王其| 国产精品2024| 久久精品一区四区| 国产一区欧美一区| 久久嫩草精品久久久久| 国产乱妇无码大片在线观看| 欧美电影免费观看高清完整版| 日本特黄久久久高潮| 欧美一区2区视频在线观看| 免费欧美在线视频| 精品久久久久一区二区国产| 蜜臀av一区二区三区| 欧美一级日韩不卡播放免费| 日本欧美加勒比视频| 91精品国产色综合久久| 久久精品72免费观看| 精品久久久久久久人人人人传媒| 热久久久久久久| 精品国产乱码久久久久久图片| 精东粉嫩av免费一区二区三区| 久久免费美女视频| 不卡电影免费在线播放一区| 一区二区在线观看免费视频播放| 在线观看网站黄不卡| 日韩影院在线观看| 91精品国产免费| 国产美女精品在线| 最好看的中文字幕久久| 日本电影欧美片| 免费成人结看片| 国产亚洲欧美在线| 91久久人澡人人添人人爽欧美| 天天色综合成人网| 久久精品欧美日韩| 日本韩国一区二区| 日本午夜精品视频在线观看| 久久久久青草大香线综合精品| 99久久综合色| 日韩国产一区二| 久久久久久久久伊人| 91影院在线观看| 免费的成人av| 国产精品久久久久影院| 欧美日韩免费在线视频|