i'm trying to create a function that uses a 2d array but whenever i try to run the program i get the" expected ')' before ','" as well as others only on the function. I've done other functions the exact same way but this one doesn't seem to work.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
#include <iostream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
using namespace std;
void printElements(int array[][], int length);
int main()
{
int employSize = 0;
cout << "How many employees are you entering information?";
cin >> employSize;
int employHours[employSize][5];
for(int i=0; i<=employSize+3; i++)
{
for(int j=0; j<=5; j++)
{
cout << "/n Enter a the number of hours this/n"
<< "employee worked for this day";
printElements(employHours, employSize);
cin >> employHours[i][j];
system('clr');
}
}
return 0;
}
//*************************************************************************
void printElements(int array[][], int length)
{
for(int i=1; i<=length; i++)
{
cout << i << "| " << "\t";
for (int j=1; j<=5; j++)
{
cout << table[i][j] << "\t";
}
cout << "\n";
}
}
|
and it gives me the following errors
C:\Users\TUFRob\Documents\EmployeeHours.cpp|28|warning: multi-character character constant [-Wmultichar]|
C:\Users\TUFRob\Documents\EmployeeHours.cpp|7|error: declaration of 'array' as multidimensional array must have bounds for all dimensions except the first|
C:\Users\TUFRob\Documents\EmployeeHours.cpp|7|error: expected ')' before ',' token|
C:\Users\TUFRob\Documents\EmployeeHours.cpp|7|error: expected unqualified-id before 'int'|
C:\Users\TUFRob\Documents\EmployeeHours.cpp||In function 'int main()':|
C:\Users\TUFRob\Documents\EmployeeHours.cpp|28|error: invalid conversion from 'int' to 'const char*' [-fpermissive]|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\stdlib.h|365|error: initializing argument 1 of 'int system(const char*)' [-fpermissive]|
C:\Users\TUFRob\Documents\EmployeeHours.cpp|36|error: declaration of 'array' as multidimensional array must have bounds for all dimensions except the first|
C:\Users\TUFRob\Documents\EmployeeHours.cpp|36|error: expected ')' before ',' token|
C:\Users\TUFRob\Documents\EmployeeHours.cpp|36|error: expected unqualified-id before 'int'|
||=== Build failed: 8 error(s), 1 warning(s) (0 minute(s), 1 second(s)) ===|
any help would be greatly appreciated