1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
expeople1 [14]
2 years ago
7

Write a program that accepts an integer value called multiplier as user input. Create an array of integers with ARRAY_SIZE eleme

nts. This constant has been declared for you in main, and you should leave it in main. Set each array element to the value i*multiplier, where i is the element's index. Next create two functions, called PrintForward() and PrintBackward(), that each accept two parameters: (a) the array to print, (b) the size of the array. The PrintForward() function should print each integer in the array, beginning with index 0. The PrintBackward() function should print the array in reverse order, beginning with the last element in the array and concluding with the element at index 0. (Hint: for help passing an array as a function parameter, see zybooks section 6.23) As output, print the array once forward and once backward.
Computers and Technology
1 answer:
Tasya [4]2 years ago
6 0

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;}

You might be interested in
The process of identifying and eliminating bugs in a software program is most generally called
12345 [234]

Answer:

Debugging is the correct answer to the given question.

Explanation:

Debugging is the process detect and eliminate the bugs in the software application .The debugging is the play important role in any  software application because if we do not remove the bugs or errors in the software application we do not get error free software application .

The debugging is comes under the category of the system development life cycle .The main objective of debugging to prohibit the programmer or the device from operating inappropriately.The programmer is checking the source code of the program find the bugs and correct it .

7 0
2 years ago
What is the meaning of photography​
Pavlova-9 [17]
Answer and Explanation:

the process or art of producing images of objects on sensitized surfaces by the chemical action of light or of other forms of radiant energy, as x-rays, gamma rays, or cosmic rays.
6 0
2 years ago
Read 2 more answers
This type of method method performs a task and sends a value back to the code that called it:
Thepotemich [5.8K]

Answer:

Option 4: Value-returning

Explanation:

In programming, a method is a named section of codes that perform a specific task. This is possible to define a method that return a value after performing its task. This type of method is known as Value-returning method.

For example, we can define a method addition that takes two inputs, x, y and return the summation of x + y to the code that called it. The codes are as follows:

  1.    public static void main(String[] args) {
  2.        int sum = addition(3, 5);
  3.    }
  4.    
  5.    public static int addition(int x, int y){
  6.        return x + y;
  7.    }

6 0
3 years ago
The computer virus is simply a.......... a. diseases b.set of computer instrustruction or code c. types of bacteria​
Svetllana [295]

Answer: b

The computer virus is simply a ___

b. Set of computer instructions or code

4 0
2 years ago
Ultraportable computers will often use ___ technology exclusively, even though their storage capacity is lower than that of a tr
ki77a [65]

Answer:

SSD

Explanation:

8 0
2 years ago
Other questions:
  • Why is driving a privilege?
    15·2 answers
  • Describe how you center text.
    7·2 answers
  • True / False
    5·1 answer
  • How would you display all your photographic work in your résumé, if you have a large volume of work?
    10·1 answer
  • 5. Question<br> The control flag that isn't really in use by modern networks is the<br> flag.
    15·1 answer
  • Provide an example where a company has demonetized a market or industry.
    8·1 answer
  • How is scale depicted on a flat video screen?
    13·1 answer
  • Which item is developed last in the cyclical design process
    11·1 answer
  • What Pre-Built PC should I get? I don't have a lot of money so I'm looking for cheap options.
    8·1 answer
  • what is the importance of familiarizing and understanding the cells rows and format tools in the microsoft cell​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!