For my Optics course, we need to write a program that will take a certain input, perform a matrix computation, and output a system matrix. The program also needs to check for nonsense input and be able to "be adjusted" for any amount of matrix elements.

I took a course in C++ a few years ago, so I think I can do this, but I needed to be reminded of what kind of steps I should take. For example:

The error checking: this will be a while statement, right? while input == disallowed input, display error message, return to input prompt?

allowing any number of matrix elements: this will be an "enter amount of optical systems here" and then assigning that value to a variable and using that number to define the size of the general expression?

multiplying the matrices: I have no idea how to do this. Is there a library that will allow me to do this easily?

outputting the information: every element in the matrix corresponds to a certain physical meaning. how do I make my program say, "the first focal point is -c1r1- " ?

Any and all advice is appreciated!