The competitive programmer's C++ translator.
use
s must be before all other code in CPC files:
use macros;
use factorial;
int main() {
...
}
will work, but
#include <iostream>
use macros;
use factorial;
int main() {
...
}
may cause unexpected behavior.
CPC is virtually identical to C++, except for having use
libraries.
To use a library, simply put use <libname>;
at the beginning of your code.
To compile your CPC program, run cpcc file.cpc
.
If you would not like the credits comments at the beginning of your code, simplify run cpcc --nocredits file.cpc
.
If you would not like warnings to be printed, simply run cpcc --Wnone file.cpc
.
As CPCC depends on its libraries, it is highly recommended that you build from source as opposed to installing a prebuilt version. You may need to install Boost for CPCC to work.
- Clone the repository:
git clone https://github.com/kevlu8/CPCC.git
- Make a build folder
cd CPCC
mkdir build
cd build
- Configure with CMake
cmake ..
- Compile the source code
make -j4
- Install the executable and libraries
sudo make install
You can now use CPCC! Run cpcc --version
to check if it is installed properly.