freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

數(shù)據(jù)結(jié)構(gòu)課程設(shè)計(jì)-赫夫曼編碼系統(tǒng)-資料下載頁

2025-06-06 01:44本頁面
  

【正文】 if (list[i].data == ch) { fputs(code[i], outFile)。 break。 } } } fcloseall()。 printf(\n 導(dǎo)出文件成功 ! 按任意鍵繼續(xù) !)。 getch()。 } void ExportCharacterWeight() { char outFileName[30]。 FILE *fp。 system(CLS)。 printf(\n 請(qǐng)創(chuàng)建導(dǎo)出文件名 : )。 fflush(stdin)。 gets(outFileName)。 if ((fp = fopen(outFileName, wb)) == NULL) { 23 / 29 printf( 輸出文件創(chuàng)建失敗 !\n)。 exit(0)。 } for(int i=0。 icodeSize。 ++i) { fprintf(fp, %c %d, info[i].data, info[i].weight)。 } fclose(fp)。 free(info)。 free(list)。 free(code)。 printf(\n 導(dǎo)出文件成功 ! 按任意鍵繼續(xù) !)。 getch()。 } void FileDecoding() { char choice。 while (true) { system(CLS)。 printf( 文件譯碼程序 \n)。 Bound(39。39。, 25)。 printf( 1. 顯 示 文 件 內(nèi) 容 \n)。 printf( 0. 返 回 主 菜 單 \n)。 Bound(39。39。, 25)。 printf( 請(qǐng)選擇 : )。 fflush(stdin)。 choice = getchar()。 switch (choice) { case 39。139。: system(CLS)。 DisplayContext()。 break。 case 39。039。: return。 24 / 29 default: printf(\n 您的輸入有誤 , 按任意鍵后請(qǐng)從新輸入 !)。 getch()。 break。 } } } void InportFileCoding() { FILE *fp。 char choice。 printf(\n 請(qǐng)輸入編碼文件名稱 : )。 fflush(stdin)。 gets(fileName)。 while ((fp = fopen(fileName, rb)) == NULL) { printf(\n 將要導(dǎo)入的文件不存在 , 是否需要重新導(dǎo)入 (Y/N)? : )。 fflush(stdin)。 choice = getchar()。 switch (choice) { case 39。Y39。: system(CLS)。 printf(\n 請(qǐng)輸入編碼文件名稱 : )。 fflush(stdin)。 gets(fileName)。 continue。 case 39。N39。: return。 default: break。 } } fclose(fp)。 printf(\n 文件導(dǎo)入成功 ! 下一步 ...\n)。 } void InportCharacterWeight() 25 / 29 { Data characterList。 Data *ptr。 FILE *fp。 char name[30]。 char data, weight。 char choice。 int characterNumber。 printf(\n 請(qǐng)輸入密鑰文件名稱 : )。 fflush(stdin)。 gets(name)。 while ((fp = fopen(name, rb)) == NULL) { printf(\n 將要導(dǎo)入的文件不存在 , 是否需要重新導(dǎo)入 (Y/N)? : )。 fflush(stdin)。 choice = getchar()。 switch (choice) { case 39。Y39。: system(CLS)。 printf(\n 請(qǐng)輸入密鑰文件名稱 : )。 fflush(stdin)。 gets(name)。 continue。 case 39。N39。: return。 default: break。 } } = NULL。 characterNumber = 0。 while (fscanf(fp, %c %d, amp。data, amp。weight) != EOF) { if ((ptr = (Data *)malloc(sizeof(Data))) == NULL) { printf( 內(nèi)存不足 , 操作失敗 !\n)。 exit(0)。 } 26 / 29 ptrdata = data。 ptrnumber = weight。 ptrnext = 。 = ptr。 ++characterNumber。 } fclose(fp)。 codeSize = characterNumber。 if ((info = (Static *)malloc(sizeof(Static) * codeSize)) == NULL) { printf( 內(nèi)存不足 , 操作失敗 !\n)。 exit(0)。 } ptr = 。 for (int i=codeSize1。 i=0。 i) { info[i].data = ptrdata。 info[i].weight = ptrnumber。 ptr = ptrnext。 } printf(\n 文件導(dǎo)入成功 ! 下一步 ...\n)。 } bool CompareData(char *tempCode, int amp。position) { for (position = 0。 position codeSize。 ++position) { if (strcmp(tempCode, code[position]) == 0) { return true。 } } return false。 } 27 / 29 void DisplayContext() { InportCharacterWeight()。 CreatHuffmanTree(list, info, codeSize)。 CreatHuffmanCode(list, code, codeSize)。 InportFileCoding()。 FILE *fp。 int position。 int end。 char *tempCode。 char ch。 fp = fopen(fileName, rb)。 if ((tempCode = (char *)malloc(sizeof(char) * codeSize)) == NULL) { printf( 內(nèi)存不足 , 操作失敗 !\n)。 exit(0)。 } end = 0。 printf(\n 文件內(nèi)容為 :\n\n )。 while ((ch = fgetc(fp)) != EOF) { tempCode[end] = ch。 ++end。 tempCode[end] = 39。\039。 if (CompareData(tempCode, position)) { printf(%c, info[position].data)。 end = 0。 } } printf(\n\n 按任意鍵結(jié)束 !)。 getch()。 28 / 29 } void Bound(char character, int size) { while (size) { putchar(character)。 } putchar(39。\n39。)。 }
點(diǎn)擊復(fù)制文檔內(nèi)容
畢業(yè)設(shè)計(jì)相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1