Code:
void case1();
void case2();
void case3();
void case4();
void case5();
//Global variables
const int MAXROW = 5;
const int MAXCOL = 5;
int main()
{
........
...
MENU(with do while)
}
void case1()
{
int A[MAXROW][MAXCOL] = { 0 };
for (int r = 0; r < MAXROW; ++r)
for (int c = 0; c < MAXCOL; ++c) {
cout << "\n A[" << r << "][" << c << "]= ";
cin >> A[r][c];
}
}
void case2()
{
...
}
//Function to find average of negatives
void case3()
{
int negNumber = 0;
double average = 0;
for (int r = 0; r < 6; ++r) {
for (int c = 0; c < 6; ++c) {
if...
}
void case4()
{//Function to find product of numbers different from 0
...
}
void case5()
{
...
}
As you can see the input array is in case1()
. What I wonder is how to use this array in all other functions (case2
, case3
, case4
, case5
).
How can I do this?
How to call them in the menu? For example case2()
:
case '2': {
case2(......);
For now my error list is full of messages like
'A': undeclared identifier