Inspired by CHelper and JHelper, I wrote small script designed for easy use of prewritten code with C++.
It removes all comments and expands all includes with filenames wrraped with ".
You can download it here https://github.com/zakharvoit/libparser.
Usage. For example let's write some file ~/lib/binpow.h
#ifndef LIB_BINPOW_H
#define LIB_BINPOW_H
int binpow(int a, int n)
{
int res = 1;
while (n > 0) {
if (n & 1) {
res *= a;
}
a *= a;
n >>= 1;
}
return res;
}
#endif
And ~/contest/main.cpp
#include <iostream>
#include "binpow.h"
using namespace std;
int main()
{
cout << binpow(2, 10) << endl;
}
Use script: ./libparser.pl ~/lib main.cpp output.cpp
Now output.cpp contains ready to submit code.
To execute this script you need perl interpreter (it should be already installed on any unix-like system). Not sure that it works on windows. If it does not work, please, write a comment.