diff options
author | Anthony Wang | 2020-05-30 03:56:00 +0000 |
---|---|---|
committer | repl.it user | 2020-05-30 03:56:00 +0000 |
commit | ef5ba0caeede8712d9ed130a8e73fef02e264528 (patch) | |
tree | 5f25840baffdaed111d3f9561c2a02b543ad573d | |
parent | 2ff6658d081e369fdab6e76041b07a6697c0bf36 (diff) |
Update main.cpp
-rw-r--r-- | .replit | 2 | ||||
-rw-r--r-- | README.md | 7 | ||||
-rw-r--r-- | src/main.cpp | 10 |
3 files changed, 14 insertions, 5 deletions
@@ -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" @@ -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); |