Hello, I'm am really new to C++; I've only been doing it for a couple of months. However, in my class, I have no idea what I've been doing wrong...I'm posting my program and the assignment because I desperately need the insight. I'm not sure if I am in the wrong or if I'm being singled out for some strange reason. I do know that I am tired of dealing with a rude instructor....

So, here is my code:

```
#include <iostream>
#include <iomanip>
#include <ctime>
using namespace std;
int arg[10][9];
int howMany( int num);
int randNum();
int numValue(int row, int col);
int howMany(int num)
{
int counter = 0;
for(int row = 0; row < 10; row++)
for(int col = 0; col < 9; col++)
{
if(arg[row][col] == num)
{
counter++;
}
}
return counter;
}
int randNum()
{
int nValue = 0;
int row;
int col;
srand((unsigned)time(0));
for (row = 0; row < 10; row++)
for (col = 0; col < 9; col++)
{
arg[row][col] = ((rand() % 10)+ 1);
}
nValue = arg[row][col];
return nValue;
}
int numValue(int row, int col)
{
int value = arg[row][col];
return value;
}
int main()
{
int row = 0;
int col = 0;
int value = 0;
int counter = 0;
int num = 0;
int nValue = 0;
for(int row = 0; row < 10; row++)
for(int col = 0; col < 9; col++)
{
randNum();
cout << arg[row][col] << "\t";
}
cout << endl;
cout << "Enter a number for the computer to search for: " << endl;
cin >> num;
cout << "Your number occurs " << howMany( num) << " times." << endl;
cout << "Enter a row and a column to search for: " << endl;
cin >> row >> col;
col += row;
cout << "Your value is: " << numValue(row,col) << endl;
return 0;
}
```

Create a function called howMany that will search a two dimensional array for the number of occurences a particular number is found within the array. Your function should return the number of occurences the number appears withing the array and the coordinates that each one is found.

Your function at the very least should take as arguments the number to search for, and the two dimensional array. You are going to need some mechanism to return the coordinates that each one is found at. You could use a string, an array, or a 2D array here but I will leave that up to you. This means your function needs at least 3 arguments.

Create another function that will take as arguments integer values that represent row, column coordinates. return the value at that location.

Write a function that will fill the array with random numbers from 1-10. Initially your array should be 10 rows by 9 columns.

Finally write some kind of driver to demonstrate the functionality of your program. It would be nice if you used some kind of a loop and a simple menu scheme.

---------------------------------------------------------------

Now, my instructor gave me permission to use however many arguments I wanted, and he wanted me to cout and cin only in main. I really would appreciate some insight in this matter. Can anyone tell me what I've done wrong?

*Edited
by pritaeas*: Fixed formatting