Like you would in any other language that don't have built-in methods to do so. There are many algorithms for this purpose, each with different properties (efficiency, stability, amplification of round-off errors, etc.) and for different kinds of matrices (general, normal, well-conditioned / ill-conditioned, symmetric, positive-/negative-definite, indefinite, rank-deficient (pseudo-inverse methods), etc.). By and large, however, inverting a matrix is rarely needed, so most methods are essentially methods to solve a system of linear equations (Ax = b), and by making the right-hand side equal to the identity matrix, you find the inverse (if that is really what you need). So, what you need to look for are methods to solve systems of linear equations. These include, but not limited to, Gaussian elimination (or its more sophisticated versions, the LU-decomposition or Cholesky decomposition (symmetric positive-definite)), QR decomposition (and variations like QL, RQ, and RRQR), Singular-value decomposition, etc... and the list goes on. There are entire books written on the subject, for example Golub and van Loan (this is pretty much the bible of matrix numerical methods).
There are also libraries that can do that for you, like Eigen, or my own, or the older classic (C) libraries like LAPACK or GSL.