This is a script to compile with g++ and run C++ files for Competitive Programming with recommendable flags. It compiles files if it's modified after its latest compilation.
Run the following commands in the Terminal.
git clone https://github.com/Wh4rp/CP-Script.git
cd CP-Script
sudo ./install.shOtherwise, you can copy script without the line 48 in your .bashrc (or .zshrc) file 😉.
To run the program, for example the file HelloWorld.cpp, use the following command in the Terminal.
CP HelloWorld.cppIf HelloWorld hasn't been compiled before, it will be compiled to HelloWorld.exe on ~/.cache. Then the program will run.
It also accepts input and output files with the follows format:
CP HelloWorld.cpp in.txt out.txt-f: forces the compilation.-d: uses the input and ouput files defined on lines 6 and 7. By default, these files are./in.txtand./out.txt(in the current directory).
Example:
CP -fd HelloWorld.cppExecutable files go to the cache_path defined in line 5. By default the cache path is ~/.cache.
- Add illustrative gifs of script on README to explain better how the program works.
- Add a Help option.
- Add a Edit default input and output files option.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.