Of course you may use class std::vector to simulate arrays. For example
#include <iostream>
#include <vector>
int main()
{
size_t n;
size_t m;
std::cout << "Enter the number of rows: ";
std::cin >> n;
std::cout << "Enter the number of columns: ";
std::cin >> m;
std::vector<std::vector<int>> v( n, std::vector<int>( m ) );
return 0;
}
Also consider using of the combination of std::vector with std::array when the number of columns is a compile time constant.
A definition of so-called 3-dimensional array can look as for example
std::vector<std::vector<std::vector<int>>>
v( 2, std::vector<std::vector<int>>( 3, std::vector<int>( 4 ) ) );
A more interesting example
#include <iostream>
#include <vector>
#include <numeric>
int main()
{
size_t n;
size_t m;
std::cout << "Enter the number of rows: ";
std::cin >> n;
std::cout << "Enter the number of columns: ";
std::cin >> m;
std::vector<std::vector<int>> v( n, std::vector<int>( m ) );
for ( size_t i = 0; i < n; i++ )
{
std::iota( v[i].begin(), v[i].end(), i * m );
}
for ( const auto &v1 : v )
{
for ( auto x : v1 ) std::cout << x << ' ';
std::cout << std::endl;
}
return 0;
}
If to enter 3 and 5 correspondingly for n and m then the output will be
0 1 2 3 4
5 6 7 8 9
10 11 12 13 14