Jeżeli nie musisz, to nie używaj tablic w stylu C++98 z poprzedniego tysiąclecia. Do tego celu można wykorzystać std::vector<int>. Zobacz przykład:
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
using table2D = vector<vector<int>>;
using table1D = vector<int>;
auto check_hits( const table2D& coupons , const table1D& draws )
{
table1D result;
for( const auto& coupon : coupons )
{
int finds {0};
for( const auto& number : coupon )
{
if( find( cbegin(draws) , cend(draws) , number ) != cend(draws) ) ++finds;
}
result.push_back(finds);
}
return result;
}
int main()
{
table2D coupons = {
{ 4 , 7 , 4 , 25 , 3 , 12 } ,
{ 21 , 5 , 24 , 15 , 3 , 12 } ,
{ 1 , 2 , 3 , 4 , 5 , 6 } ,
{ 31 , 21 , 3 , 4 , 5 , 6 } ,
{ 1 , 7 , 2 , 12 , 13 , 31 }
};
table1D draws = { 1 , 7 , 2 , 12 , 13 , 14 };
for( const auto& match : check_hits( coupons , draws ) )
{
cout << match << endl;
}
}