高分可追加到400用C 語言實現簡單的資料壓縮與加解密系統,求大神幫忙

時間 2021-07-05 18:13:34

1樓:

請問編譯器是什麼?

下面的程式適用於 linux的gcc,如果要win32 console,只需簡單修改:

#include

#include

#ifdef __gnuc__

# include

#else

# include

#endif

int compess(file *fsrc, file *fdest, int n)

while (0 != (num = fread(buf, 1, 128, fsrc)))

}else

}fwrite(ch, 1, j, fdest);

}return 0;

}int restore(file *fsrc, file *fdest, int n)

while (0 != (num = fread(buf, 1, 128, fsrc)))

else

}fwrite(ch, 1, j, fdest);

}return 0;

}int encrypt(file *fsrc, file *fdest, int n)

while (0 != (num = fread(buf, 1, 128, fsrc)))

fwrite(buf, 1, num, fdest);

}return 0;

}int decrypt(file *fsrc, file *fdest, int n)

while (0 != (num = fread(buf, 1, 128, fsrc)))

fwrite(buf, 1, num, fdest);

}return 0;

}void menu()

;typedef int (*pfun)(file*, file*, int);

pfun func = ;

loop:

#ifdef __gnuc__

system("clear");

#else

system("cls");

#endif

printf(" ************** 檔案管理系統 **************\n");

printf("\t1, ------------------------> 壓縮\n");

printf("\t2, ------------------------> 解壓\n");

printf("\t3, ------------------------> 加密\n");

printf("\t4, ------------------------> 解密\n");

printf("\t5, ------------------------> 退出\n");

printf("\n選擇要執行的操作:");

scanf("%d", &sel);

getchar();

if (sel >= 1 && sel <= 4)

printf(" 輸入%s後檔案的名字:", str[sel - 1]);

gets(buf);

fp1 = fopen(buf, "w");

if (null == fp)

if (sel == 3 && sel == 4)

(*func)(fp, fp1, n);

fclose(fp);

fclose(fp1);

}else if (sel == 5)

return;

else

printf("完成操作,繼續?(y/n)");

ch = getchar();

if (ch == 'y' || ch == 'y')

goto loop;

}int main()

2樓:匿名使用者

我想來啊。反正晚上回家不是打檯球就是看恐怖片。

先問幾個問題。

1.介面是不是windows視窗,或者dos字元介面都可以?

2.要求支援中文字元嗎?如果是隻支援英文字元,會簡單很多,反之會麻煩很多。

3.期待幾天完成?

3樓:匿名使用者

兄弟還需要不,上面的那位是你老師?挺悲劇的啊

4樓:罵了隔b的

mark,回去寫下看,白天要上班

5樓:匿名使用者

不知任務完成了沒有,沒有的話我來拿分了

完整正確的C語言二叉樹程式,用c語言實現二叉樹的程式,可以輸入輸出和遍歷

include using namespace std class node node node getleft void setleft node l node getright void setright node r char getdata void setdata const int in...

c語言裡可以用vector嗎,c語言裡面可以用stl嗎?

就算是c 我也一向不用vector,我一直認為自己用指標去實現的話,寫出的 應該是效率最高的 旁笑槐 c語言不能用vector,但你可以自己寫個隨機訪問adt或連結串列adt 僅僅是c標準庫沒提供vector的功能而已,你完全可以自己寫。 1 c語言不能用vector,c標準庫沒提供vector的功...

順序表的初始化怎麼用C語言實現?舉個例子,不勝感激

e,糾正一下,嚴重錯誤。如果是連結串列,則需要一個節點一個節點的進行初始化pnode sqlist.phead while pnode null 你所說的順序表就是指單向連結串列吧。舉個例子 宣告 typedef struct queuequeuetype 定義結構體型別 typedef queue...