So you're saying a and b can be very high, but you dont know just how?

One way is, use a single dimension array that can expand to your whim.

Code:

#include <vector>
#include <iostream>
using namespace std;
int main() {
vector <int> matrix; //Creates a vector with an expandable size.
unsigned int x;
matrix.push_back(10); //Adds an element to the vector, with a value of 10.
matrix.push_back(5); //Adds another element with a value of 5.
for(x=0; x < matrix.size(); x++)
cout << matrix[x]; //Couts the integer value of matrix[x].
matrix.pop_back(); //Deletes the last added element of the vector.
}

Your other option (WARNING! DO NOT RUN THIS CODE!)

You might be able to use a 2d vector, but I dont know. Wait...

Code:

vector <int> MatrixPartOne;
vector <int> MatrixPartTwo;

Their :P. The only problem is its two seperate entities. If you want more on vectors, http://www.cppreference.com/cppvector/ .

If I didint answer your question, I blame vectors for intoxicating me .