Write a C++ program that prompts the user to enter the dimensions of a matrix and its elements. The program should then display the transpose matrix of the entered matrix. The program should include error handling to ensure that only valid inputs are accepted. The output should be neatly formatted and appropriately labeled to clearly indicate the transpose matrix. The program should be implemented using functions and appropriate comments should be included to improve readability and maintainability.
This prompt doesn't seem malicious.