Answer:
The program in C++ is as follows:
#include <iostream>
using namespace std;
void PrintForward(int myarray[], int size){
for(int i = 0; i<size;i++){ cout<<myarray[i]<<" "; }
}
void PrintBackward(int myarray[], int size){
for(int i = size-1; i>=0;i--){ cout<<myarray[i]<<" "; }
}
int main(){
const int ARRAY_SIZE = 12;
int multiplier;
cout<<"Multiplier: ";
cin>>multiplier;
int myarray [ARRAY_SIZE];
for(int i = 0; i<ARRAY_SIZE;i++){ myarray[i] = i * multiplier; }
PrintForward(myarray,ARRAY_SIZE);
PrintBackward(myarray,ARRAY_SIZE);
return 0;}
Explanation:
The PrintForward function begins here
void PrintForward(int myarray[], int size){
This iterates through the array in ascending order and print each array element
<em> for(int i = 0; i<size;i++){ cout<<myarray[i]<<" "; }</em>
}
The PrintBackward function begins here
void PrintBackward(int myarray[], int size){
This iterates through the array in descending order and print each array element
<em> for(int i = size-1; i>=0;i--){ cout<<myarray[i]<<" "; }</em>
}
The main begins here
int main(){
This declares and initializes the array size
const int ARRAY_SIZE = 12;
This declares the multiplier as an integer
int multiplier;
This gets input for the multiplier
cout<<"Multiplier: "; cin>>multiplier;
This declares the array
int myarray [ARRAY_SIZE];
This iterates through the array and populate the array by i * multiplier
<em> for(int i = 0; i<ARRAY_SIZE;i++){ myarray[i] = i * multiplier; }</em>
This calls the PrintForward method
PrintForward(myarray,ARRAY_SIZE);
This calls the PrintBackward method
PrintBackward(myarray,ARRAY_SIZE);
return 0;}