-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
32 lines (27 loc) · 842 Bytes
/
Copy pathmain.cpp
File metadata and controls
32 lines (27 loc) · 842 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "huffmanTree\include\huffman.h"
#include <iostream>
using namespace std;
int main() {
string cipherTextAddress = "D:\\Desktop\\HUFFMAN_TREE\\ioFile\\cipherText.txt";
string plainTextAddress = "D:\\Desktop\\HUFFMAN_TREE\\ioFile\\plainText.txt";
cout << "Enter 1 to encode" << endl;
cout << "Enter 2 to decode" << endl;
huffman h;
h.createTree();
h.storeCodes(h.root, "");
char chioce; cin >> chioce;
switch (chioce) {
case '1':
//h.printCodes(h.root, "");
h.encode(cipherTextAddress, plainTextAddress);
break;
case '2':
//h.printCodes(h.root, "");
h.decode(h.root, cipherTextAddress, plainTextAddress);
break;
default:
cout << "Invalid choice" << endl;
cout << "Please enter 1 or 2" << endl;
}
return 0;
}