How to assign rows of multidimemsional array specific values

I have the following code below. My instructions are as follows:
fill the first row of array2 with values from array1. Fill the second row of array2 with values from array1, except with the values in reverse order. Fill the third row of array 2 with values from array1, except each value in array2 will be the sum of the corresponding value in array1 plus its opposite-end value in array1, i. e., the first value in array1 will be added to the last value in array1, the second value in array1 will be added to the second-to-last value in array1,..., the last value in array1 will be added to the first value in array1.

My code so far:
const int CLM = 10;

int* Fill_Array1(const int CLM);

void Fill_Array2(int array2[][CLM], const int ROW, int* digit);

int main()
{
//define variables
const int ROW = 3, CLM = 10;
int array2[ROW][CLM];
int* dim1Array_ptr, *dim1Array, digit;




dim1Array = Fill_Array1(CLM);
dim1Array_ptr = dim1Array;


Fill_Array2(array2, ROW, &digit);



cout << endl << endl;
system("pause");
return (0);

}
int* Fill_Array1(const int CLM)
{
int digit;
int* intgrs_p = NULL; //dynamically assigning new array to use
intgrs_p = new int[CLM];

for (int i = 0; i < CLM; i++)
{
cout << "\nEnter an integer between 0 and 1000:>";
cin >> digit;
while (digit <= 0 || digit >= 1000)
{
cout << "\nInput Error : Digits must be greater than 0 and less than 1000 : RE - Enter..>";
cin >> digit;
}
*(intgrs_p + i) = digit;

}
return(intgrs_p);
}
void Fill_Array2(int array2[][CLM], const int ROW, int* digit)
{
for (int i = 0; i < ROW; i++)
{
for (int j = 0; j < CLM ; j++)
{

array2[0][CLM] = *digit;
cout << array2[0][CLM] << endl;
array2[1][CLM] = *digit + j;

}

}

}

I am getting confused on how to fill the multidimensional array by using the values in my first array. Any pointers in the right direction are much appreciated
Use the code tags.
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
const int CLM = 10;

int* Fill_Array1(const int CLM);

void Fill_Array2(int array2[][CLM], const int ROW, int* digit);

int main()
{
  //define variables
  const int ROW = 3, CLM = 10;
  int array2[ROW][CLM];
  int* dim1Array_ptr, *dim1Array, digit;




  dim1Array = Fill_Array1(CLM);
  dim1Array_ptr = dim1Array;


  Fill_Array2(array2, ROW, &digit);



  cout << endl << endl;
  system("pause");
  return ( 0 );

}
int* Fill_Array1(const int CLM)
{
  int digit;
  int* intgrs_p = NULL; //dynamically assigning new array to use 
  intgrs_p = new int[CLM];

  for (int i = 0; i < CLM; i++)
  {
    cout << "\nEnter an integer between 0 and 1000:>";
    cin >> digit;
    while (digit <= 0 || digit >= 1000)
    {
      cout << "\nInput Error : Digits must be greater than 0 and less than 1000 : RE - Enter..>";
      cin >> digit;
    }
    *( intgrs_p + i ) = digit;

  }
  return( intgrs_p );
}
void Fill_Array2(int array2[][CLM], const int ROW, int* digit)
{
  for (int i = 0; i < ROW; i++)
  {
    for (int j = 0; j < CLM; j++)
    {

      array2[0][CLM] = *digit;
      cout << array2[0][CLM] << endl;
      array2[1][CLM] = *digit + j;

    }

  }

}
Topic archived. No new replies allowed.