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

正文內(nèi)容

課程設(shè)計-赫夫曼編碼系統(tǒng)設(shè)計-在線瀏覽

2025-03-02 18:45本頁面
  

【正文】 eCoding()。int position。char *tempCode。fp = fopen(fileName, rb)。exit(0)。/******************************此部分為解碼過程************************/printf(\n 文件內(nèi)容為:\n\n )。++end。\039。end = 0。getch()。所以綜上,次此的程序只能進(jìn)行簡單的加密與解密操作。在此次選擇赫夫曼編碼操作的時候,本打算用赫夫曼編碼的程序?qū)ξ募M(jìn)行壓縮存儲,可是限于不知道怎樣將生成的赫夫曼編碼進(jìn)行 bit 級別的存儲(只知道進(jìn)行 Byte 級別的存儲) ,所以壓縮存儲的想法失敗了,之后根據(jù)赫夫曼編碼的結(jié)構(gòu)及生成的文件,不得不讓我想到了文件的加密與解密,于是按著這個思路來設(shè)計了本文件加密解密系統(tǒng)。 13 / 32總體感覺程序還行,就是代碼的簡潔性還是有點(diǎn)差,條理還是不那么清晰。 int weight。}HuffmanTree。int weight。//統(tǒng)計字符時所用到的鏈表結(jié)構(gòu)typedef struct node{char data。struct node *next。//赫夫曼代碼結(jié)構(gòu)typedef char** HuffmanCode。list, Static *info, int codeSize)。code, int codeSize)。info)。//創(chuàng)建文件編碼void CreatFileCoding()。//導(dǎo)出文件中字符權(quán)重void ExportCharacterWeight()。//導(dǎo)入編碼后的文件void InportFileCoding()。//顯示譯碼后的文件內(nèi)容void DisplayContext()。position)。//赫夫曼樹HuffmanTree *list。//字符權(quán)重信息Static *info。//文件名char fileName[30]。 15 / 32while (true){system(CLS)。Bound(39。, 25)。printf( 2. 文 件 譯 碼 \n)。Bound(39。, 25)。fflush(stdin)。switch (choice){case 39。:FileEncoding()。case 39。:FileDecoding()。case 39。:printf(\n)。return 0。default:printf(\n 您的輸入有誤, 按任意鍵后請從新輸入!)。break。list, Static *info, int codeSize){int i, j, limit。 int value1, value2。 16 / 32limit = codeSize * 2 1。exit(0)。 icodeSize。ptrweight = info[i].weight。}for(。 ++i, ++ptr){ptrdata = 39。ptrweight = 0。} for(i=codeSize。 ++i){ value1 = value2 = 32767。 for(j=0。 ++j) {if (list[j].parent == 1){ if (list[j].weight value1){ value2 = value1。 value1 = list[j].weight。} else if (list[j].weight value2){ value2 = list[j].weight。}}} 17 / 32 list[lnode].parent = i。 list[i].weight = list[lnode].weight + list[rnode].weight。list[i].rchild = rnode。code, int codeSize){int i, start。 char *tempCode。exit(0)。exit(0)。\039。 icodeSize。for(flag1=i, flag2=list[i].parent。 flag1=flag2, flag2=list[flag2].parent){if (list[flag2].lchild == flag1){tempCode[start] = 39。}else{tempCode[start] = 39。 18 / 32}}if ((code[i] = (char *)malloc(sizeof(char) * (codeSize start))) == NULL){printf( 內(nèi)存不足, 操作失敗!\n)。}strcpy(code[i], amp。}free(tempCode)。info){FILE *fp。char choice。Data characterList。system(CLS)。fflush(stdin)。while ((fp = fopen(fileName, rb)) == NULL){printf(\n 您需要打開的文件不存在, 是否需要重新打開(Y/N)? : )。choice = getchar()。Y39。printf(\n 請輸入需要打開的文件名稱: )。gets(fileName)。 19 / 32case 39。:return。}}characterNumber = typeNumber = 0。while ((ch = fgetc(fp)) != EOF){current = 。exit(0)。ptrnumber = 1。 = ptr。}else{while ((current != NULL) amp。 (currentdata != ch)){previous = current。}if (current != NULL){++(currentnumber)。}else{ 20 / 32if ((ptr = (Data *)malloc(sizeof(Data))) == NULL){printf( 內(nèi)存不足, 操作失敗!\n)。}ptrdata = ch。ptrnext = current。++typeNumber。}}}fclose(fp)。info = (Static *)malloc(sizeof(Static) * codeSize)。for (int i=0。 ++i){info[i].data = currentdata。current = currentnext。while (true){system(CLS)。Bound(39。, 25)。printf( 2. 導(dǎo) 出 文 件 編 碼 \n)。printf( 0. 返 回 主 菜 單 \n)。39。printf( 請選擇: )。choice = getchar()。139。break。239。break。339。break。039。default:printf(\n 您的輸入有誤, 按任意鍵后請從新輸入!)。break。CreatHuffmanTree(list, info, codeSize)。printf(\n 創(chuàng)建文件編碼成功! 按任意鍵繼續(xù)!)。}void ExportFileEncoding(HuffmanTree *list, HuffmanCode code, int codeSize){int i。char outFileName[30]。 22 / 32system(CLS)。printf(\n 請創(chuàng)建導(dǎo)出文件名: )。gets(outFileName)。exit(0)。 icodeSize。break。printf(\n 導(dǎo)出文件成功! 按任意鍵繼續(xù)!)。}void ExportCharacterWeight(){char outFileName[30]。system(CLS)。fflush(stdin)。 23 / 32if ((fp = fopen(outFileName, wb)) == NULL){printf( 輸出文件創(chuàng)建失敗!\n)。}for(int i=0。 ++i){fprintf(fp, %c %d, info[i].data, info[i].weight)。free(info)。free(code)。getch()。while (true){system(CLS)。Bound(39。, 25)。printf( 0. 返 回 主 菜 單 \n)。39。printf( 請選擇: )。choice = getchar()。139。DisplayContext()。 24 / 32case 39。:return。getch()。}}}void InportFileCoding(){FILE *fp。printf(\n 請輸入編碼文件名稱: )。gets(fileName)。fflush(stdin)。switch (choice){case 39。:system(CLS)。fflush(stdin)。continue。N39。default:break。printf(\n 文件導(dǎo)入成功! 下一步...\n)。Data *ptr。char name[30]。char choice。printf(\n 請輸入密鑰文件名稱: )。gets(name)。fflush(stdin)。switch (choice){case 39。:system(CLS)。fflush(stdin)。continue。N39。default:break。characterNumber = 0。data, amp。 26 / 32exit(0)。ptrnumber = weight。 = ptr。}fclose(fp)。if ((info = (Static *)malloc(sizeof(Static) * codeSize)) == NULL){printf( 內(nèi)存不足, 操作失敗!\n)。}ptr = 。 i=0。info[i].weight = ptrnumber。}printf(\n 文件導(dǎo)入成功! 下一步...\n)。position){for (position = 0。 ++position){if (strcmp(tempCode, code[position]) == 0){return true。}void DisplayContext(){InportCharacterWeight()。CreatHuffmanCode(list, code, codeSize)。FILE *fp。int end。char ch。if ((tempCode = (char *)malloc(sizeof(char) * codeSize)) == NU
點(diǎn)擊復(fù)制文檔內(nèi)容
環(huán)評公示相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1