#include<iostream>
usingnamespace std;
void getInput(int[][2],int);
void netSalary(int[][2],int);
main()
{
constint arraySize= 100;
/*getInput();
netSalary();
unlucky();
displayOutPut(); */
int sal[arraySize][2];
int lucky[100] = {0};
int numEmps;
cout<<"Please Enter Total Number Of Employees: ";
cin>>numEmps;
getInput(sal[][2],numEmps); //Calling Function To Get Input
netSalary(sal[][2],numEmps);
}
void getInput(int sal[][2], int numEmps) //Function To get Input
{
for(int i = 0; i<numEmps; i++)
{
cin>>sal[1][0];
}
}
#include<iostream>
usingnamespace std;
constint arraySize = 100; // <--- Moved here so thet it is availavle to everything.
constexprint MAXCOL{ 2 }; // <--- Added
void getInput(int[][MAXCOL], int); // <--- Changed
void netSalary(int[][MACOL], int); // <--- Changed
main()
{
/*getInput();
netSalary();
unlucky();
displayOutPut(); */
int sal[arraySize][MAXCOL]; // <--- Changed
int lucky[arraySize] = { 0 }; // <--- Changed
//int lucky[arraySize][MAXCOL]{ 0 }; // <--- Another way to define the array.
int numEmps;
cout << "Please Enter Total Number Of Employees: ";
cin >> numEmps;
getInput(sal, numEmps); //Calling Function To Get Input
netSalary(sal, numEmps);
}
void getInput(int sal[][MAXCOL], int numEmps) //Function To get Input <--- Changed
{
// <--- Nested for loops to deal with the array better. Both loops start at 0.
for (int i = 0; i < numEmps || i < arraySize; i++) // <--- || keeps you going past your array bounds.
{
for (int j = 0; j < MAXCOL; j++)
{
cin >> sal[i][J];
}
}
}