lillie62
asked on
write the heading function that take two arrays, and return a bool result in C++ program
I had write the three arrays type called DataSet with three arrays: input, output, and working. Each array hole 5 float values.
const MY_INPUT =4;
const MY_OUTPUT = 4;
const MY_WORKING = 4;
float DataSet[MY_INPUT][MY_OUTPU T][MY_WORK ING];
float input;
float output;
float working;
And now I need to write a heading function called Equals that take two arrays for the DataSet type and returns a bool result. The array parameters should be const, as they are input-only parameters to the function , but I got stuck on it, could you help me for the solution to complete this part. Thank you very much for your help.
const MY_INPUT =4;
const MY_OUTPUT = 4;
const MY_WORKING = 4;
float DataSet[MY_INPUT][MY_OUTPU
float input;
float output;
float working;
And now I need to write a heading function called Equals that take two arrays for the DataSet type and returns a bool result. The array parameters should be const, as they are input-only parameters to the function , but I got stuck on it, could you help me for the solution to complete this part. Thank you very much for your help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can use typdef to define the 3d type.
Example:
I would recommend using vector< vector< vector<float> > > type over C style 3D array type.
Example:
const int MY_INPUT =4;
const int MY_OUTPUT = 4;
const int MY_WORKING = 4;
typedef float MY_3D_DATASETTYPE[MY_INPUT][MY_OUTPUT][MY_WORKING];
bool MyFunction(MY_3D_DATASETTYPE &DataSet)
{
return false;
}
// ... Some code usage:
float DataSet[MY_INPUT][MY_OUTPUT][MY_WORKING] = {0};
MyFunction(DataSet);
I would recommend using vector< vector< vector<float> > > type over C style 3D array type.
Open in new window
you could pass any of those arrays by defining a variable of type THREE_ARRAYS
and then use the member variable like
Open in new window
the function could be defined as 'bool func(const float* input , int elements)';
Sara