Git Product home page Git Product logo

cpcpp's Introduction

CPCPP - Competitive Programming C/C++ Script

Description

cpcpp - is an useful script which will enhance your productivity of solving Competitive Programming Problems by helping you to automate some common routines like building your code with some mostly used GCC flags, running your code on different tests without executing it many times, and providing nice visual colorings :3

Script only works for C/C++

Table of Contents

Installation

  1. Clone the repository:

    % git clone https://github.com/reestear/cpcpp.git
  2. Navigate to the project directory

    % cd ./cpcpp
  3. Copy script to your PATH directory

    % sudo mv cpcpp.sh <PATH>/cpcpp

    Where PATH directory on UNIX systems is by default any of following:

    /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
    
  4. Activate Script

    % sudo chmod +x <PATH>/cpcpp
  5. Look at the usage of script

    % cpcpp

Usage

  1. Navigate to the directory where your code is located and run:

    % cpcpp <filename>

    In this way, the script will build the program with default GCC Optimization flags with -std=c++20 and run the program immediately if compilation was succesful, otherwirse an error message will be displayed indicating an unsuccesful compilation.

    The same behavior can be generated using -r and -b flags, which will be discussed shortly later on:

    % cpcpp <filename> -b -r
  2. Run existing executable without rebuilding the same source file

    % cpcpp <filename> -r

    If there exists an executable named <filename>, but without its .cpp or .c extension, then it will just run the existing program without compiling the source code.

    Otherwise, an error message will be displayed and program wouldn't be executed.

  3. There exists similar option but only for building

    % cpcpp <filename> -b

    This way it will only compile the source code without executing the final output.

  4. If you want to run the same code on multiple tests (Not those tests which will be run in the program itself)

    % cpcpp <filename> --tests=<X>

    or

    % cpcpp <filename> -t <X>

    Where, X stays for the number of tests which should be executed i.e how many times the program will be executed.

    Keep in mind that --tests= has a higher priority over -t. Also, if no natural number representing number of tests is provided after -t flag then an error message will be displayed.

  5. You can combine flags

    % cpcpp <filename> -r -t 5
    

    This will run your existing executable on 5 tests.

    % cpcpp <filename> -b -r -t 5
    

    This will build and run your code on 5 tests. (Essentially the same as cpcpp <filename> -t 5)

cpcpp's People

Contributors

reestear avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.