I have two functions I need to write and I am having trouble writing them.
First function receives an array of long and returns the 2nd value stored in the array.
Then second function receives a 2 dimensional array of long double with 10 columns. Also you will receive a short value representing the number of rows. The function totals all of the amounts in the array. The total of the values is returned as a long double.
If anyone can help me I would appreciate it.
Thanks,
R.
#include <iostream>
usingnamespace std;
int *F1(long array[], int size);
longdouble F1(longdouble array[][10], short rows);
int main()
{
long ARRAY3[4] = {1, 2, 3, 4};
int *secondValue = F1(ARRAY);
cout << "The second value of ARRAY3 is " << secondValue << endl;
long ARRAY4[2][3] = {{ 1, 2, 3,}, {2, 3, 4}};
longdouble total;
total = F1(ARRAY4, 2);
cout << "The total for ARRAY4 is " << total << endl;
system("pause");
return 0;
}
int *F1(long array[])
{
int *ptr;
ptr = array[1];
}
longdouble F1(longdouble array[][10], short rows)
{
longdouble total = 0;
for(int i = 0; i < rows; i++)
{
for(int j = 0; j < 10; j++)
{
total += array[i][j];
}
}
return total;
}