I'm not a big fan of doing what appears to be someone else's homework, so instead I'll summarise some thoughts on your problem, which will hopefully be more enlightening than simply posting the solution.
You've probably done 3x3 determinants before, and noticed that the method relies on using the individual 2x2 determinants left over from crossing out a row and a column. You then multiply by the doubly crossed number, and +/- alternately.
So, for a 4x4 matrix, you would simply extend this algorithm. This would then require you to find the determinants of the remaining 3x3 matrices after crossing out a col+row.
Basically, you need a recursive program that does this.
Also, it sounds this question is part of a larger algorithm design course, where you're meant to appreciate that this algorithm isn't very scalable, ie for larger matrices it takes a huge number of calculations.
From what I remember, LU-decomposition is a good alternative that allows matrix inversion with good scaling properties.