You better structure your code better. These internal functions are bad style. Use some own classes and some STL containers like vector.
I guess that you may visit some
C++ tutorial to enhance your knowledge. Spending that time is worth it and will improve your code.
tip: write some code with test data to debug more easily.