aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Wang2020-05-30 03:56:00 +0000
committerrepl.it user2020-05-30 03:56:00 +0000
commitef5ba0caeede8712d9ed130a8e73fef02e264528 (patch)
tree5f25840baffdaed111d3f9561c2a02b543ad573d
parent2ff6658d081e369fdab6e76041b07a6697c0bf36 (diff)
Update main.cpp
-rw-r--r--.replit2
-rw-r--r--README.md7
-rw-r--r--src/main.cpp10
3 files changed, 14 insertions, 5 deletions
diff --git a/.replit b/.replit
index b9a1fe1..9958aaf 100644
--- a/.replit
+++ b/.replit
@@ -1,2 +1,2 @@
language = "cpp"
-run = "g++ src/*.cpp -o compress -std=c++1y; echo Compilation done; ./compress"
+run = "g++ src/*.cpp -o compress -std=c++1y; echo Compilation done; ./compress soc1.txt 50"
diff --git a/README.md b/README.md
index 10aacdf..9ee960a 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,6 @@
-# Compression-Project \ No newline at end of file
+# Compression-Project
+
+## Usage
+
+Compile: `g++ src/*.cpp -o compress -std=c++1y`
+Run: `./compress [input file] [compression ratio]` \ No newline at end of file
diff --git a/src/main.cpp b/src/main.cpp
index c8f8baf..3d5562a 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -312,14 +312,14 @@ int initsize=0;
int compressrate;
int targetsize;
-int main() {
+int main(int argc, char *argv[]) {
string input="";
- string input_file = "soc1.txt";
+ string input_file = argv[1];
//cin >> input_file;
string line;
- cin>>compressrate;
+ compressrate = atoi(argv[2]);
ifstream stin(input_file);
compressrate = 100 - compressrate;
@@ -375,7 +375,11 @@ int main() {
//where can i find a library of words in categories can't find any
// not really sure
+ // im not getting anywhere with weighting lol
+ // there is no list i can find
+
+ //!!! are we counting input size correctly bc the \r issue?
s = huffmancompress(s);
int orig_size = 0;
ifstream testin(input_file);