Matrix operations using classes
Partial Answer This does not cover all aspects of your code, so feel free to wait for other responses.

In OOP, it is important to identify the scope of an object. In your case, you have two input matrices and possibly a result matrix for the operation that the user selects. The key point is, that each matrix should be a distinguished instance of your matrix class. What you have is something like a matrix manager, that contains multiple matrices in a single instance.

When you re-design your matrix class to contain a single matrix, you should possibly externalize your user input logic. Also, the sum, diff and transpose functions could be external functions that take two matrices as parameters and return a resulting matrix. However, I guess it would also be ok to have them as member function that only takes the second matrix as parameter.

Consider the following class definition:

#include &lt;vector&gt;

class matrix {
private:
    // matrix with m columns and n rows
    int _m, _n;
    // values, organized as an outer vector of rows
    // and an inner vector of columns
    std::vector&lt;std::vector&lt;int&gt;&gt; _values;

public:
    // initialize matrix by its size
    matrix(int m, int n)
        : _m(m), _n(n)
    {
        // initialize the matrix size
        _values.resize(n);
        for (int i = 0; i &lt; n; ++i)
        {
            _values[i].resize(m);
        }
    }

    // TODO:
    // - other constructors
    // - copy operator
    // - other desired functions
    // - assessors to the matrix elements
};


Maybe you can start from there.