First of all, it is impossible to completely rewrite
NIntegrate because usually, it evaluates (parts of) the integrand symbolically to check for certain properties. This means, you probably have to re-implement Mathematica completely.
Nevertheless, if you are tackling one specific integral, I assume chances are very good that you can get similar numerical results by re-implementing some parts in C++ or using a library.
I would start by analysing (in Mathematica) what algorithm is used for your integral. In this tutorial you can find details about how Mathematica chooses the algorithm when
After this, you should study the help-page of
NIntegrate carefully to understand how it works. Then you should go on by
- fixing the
Method option of
EvaluationMonitor to see where your integrand is sampled
- using specific
MaxRecursion, etc settings
until you finally get equally good results. If you have achieved this, then you know what algorithm you have to implement or find in C++ library.
Let me say that there is another way: Understand the integral you want to solve! You as human should see what type of integrand you have and you can check the literature, how those types are solved numerically. This is probably faster than trying to understand what Mathematica does.