still pretty new to C++. 
Had to write a function in class to count the number of each digit in a multi-dimensional array. 
Now I didn't think you could return multiple `int` values from a single called function and then use all of these returns in a text based answer, so I attempted to `return` a different value depending on the value requested as parameter for each digit.

The code below is unnecessarily long and I'm still receiving the following errors.

```
main-1-3.cpp: In function 'int main()':
main-1-3.cpp:12:21: error: too few arguments to function 'int 
count_numbers(int(*)[4], int)'
count_numbers(array);
                 ^
main-1-3.cpp:7:12: note: declared here
extern int count_numbers(int array[4][4], int);

```

With a bit of debugging I could likely fix up these compile errors, but I feel like my method is extremely convoluted and was wondering if it were possible to call the function as:

```
count_number(array[4][4])

```

(Removing the need for the Q parameter) and then have `count_numbers`return all ten of the number values and the just output them as text like `<< ",3:" << three <<` instead of `<< ",8:" << count_numbers(array, 8) <<`

Anyway, the function.cpp and main.cpp are below. 
If anyone could point me in the right direction it would greatly appreciated. Just need to know the correct method so I can condense this code.

**function.cpp**

```
#include <iomanip>
#include <locale>
#include <sstream>
#include <string>
#include <iostream>

int count_numbers(int array[4][4], int Q)
{
    int X=0;
    int Y=0;
    int zero=0;
    int one=0;
    int two=0;
    int three=0;
    int four=0;
    int five=0;
    int six=0;
    int seven=0;
    int eight=0;
    int nine=0;
while(X<4)
{
    if(array[X][Y]==0)
    {
        zero=zero+1;
    }
    if(array[X][Y]==1)
    {
        one=one+1;
    }
    if(array[X][Y]==2)
    {
        two=two+1;
    }
    if(array[X][Y]==3)
    {
        three=three+1;
    }
    if(array[X][Y]==4)
    {
        four=four+1;
    }
    if(array[X][Y]==5)
    {
        five=five+1;
    }
    if(array[X][Y]==6)
    {
        six=six+1;
    }
    if(array[X][Y]==7)
    {
        seven=seven+1;
    }
    if(array[X][Y]==8)
    {
        eight=eight+1;
    }
    if(array[X][Y]==9)
    {
        nine=nine+1;
    }
    Y++;
    if(Y==4)
    {
        Y=0;
        X++;
    }
}

if(Q==0)
{
    return zero;
}
if(Q==1)
{
    return one;
}
if(Q==2)
{
    return two;
}
if(Q==3)
{
    return three;
}
if(Q==4)
{
    return four;
}
if(Q==5)
{
    return five;
}
if(Q==6)
{
    return six;
}
if(Q==7)
{
    return seven;
}
if(Q==8)
{
    return eight;
}
if(Q==9)
{
    return nine;
}

}

```

**main.cpp**

```
#include <iomanip>
#include <locale>
#include <sstream>
#include <string>
#include <iostream>

extern int count_numbers(int array[4][4], int);

int array[4][4] = { {1,2,3,4} , {1,2,3,4} , {1,2,3,4} , {1,2,3,4}};
int main()
{
count_numbers(array);
std::cout << ",0:" << count_numbers(array, 0) << ",1:" << count_numbers(array, 1) << ",2:" << count_numbers(array, 2) << ",3:" << count_numbers(array, 3) << ",4:" << count_numbers(array, 4) << ",5:" << count_numbers(array, 5) << ",6:" << count_numbers(array, 6) <<",7:" << count_numbers(array, 7) << ",8:" << count_numbers(array, 8) << ",9:" << count_numbers(array, 9) << std::endl;
}

```

PS. Ignore incorrect indentation its just from pasting to this site

PPS. Thanks for any assistance.

*****EDIT*****
Thank you "Vlad From Moscow" for the assistance.
My initial (terrible) code would have worked if I'd simply removed the (unintentional) `count_number(array);` call from `main.cpp` 

However the for loop system proposed by Vlad allowed me to shrink the code by 80%. It now looks like this:

```
int count_numbers(int array[4][4], int Q)
{
int ans=0;
for(int i=0; i<4; i++)
{
    for(int j=0; j<4; j++)
    {
        ans += array[i][j] ==Q;
    }
}
return ans;
}

```

Thank you for the assistance which was great, I began coding on Python so it was my lack of understanding of loops in C++ which was the real problem here.
Anyway, problem solved..