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
How to write "There are four parking spots on campus that may be used only by Nobel Prize winning faculty." this sentence correc
dexar [7]
"On campus there are four parking spots, that may only be used by Nobel Prize winning faculty"

That's how I would write the sentence.
5 0
3 years ago
Rachael has been posting negative comments on several of her peers' social media pages. Which of the six Ps is Rachael abusing?
posledela
The answer is D. Personification
4 0
3 years ago
You can invoke or call a method from another program or method. When methods must share data, you can pass the data into and ret
san4es73 [151]

Answer:

1. You can invoke or call a method from another program or method: TRUE

2. When methods must share data, you can pass the data into and return the data out of methods: TRUE

3. A method could be called using any numeric value as an argument, whether it is a variable, a named constant, or a literal constant: TRUE

Explanation:

4 0
3 years ago
John is considering his STEM education choices. He wants to begin working in the technology field as soon as possible.
wariber [46]

Answer:

The answer to this question is given below in the explanation section.

Explanation:

STEM is a curriculum based on the idea of educating students in four specific disciplines — science, technology, engineering,  and mathematics — in an interdisciplinary and applied approach. The students who graduated in STEM-based education getting more paid and jobs than students who did not study the STEM-based education.

As in this question that John is considering his STEM education choices, and he wants to begin working in the technology field as soon as possible. He should pursue bachelor (graduate) degree in technology. Because after, passing out, he can begin working in technology easily.

5 0
3 years ago
A sequence of repetitive operations performed to evaluate the ability of a PC to operate at peak efficiency for a defined time p
iragen [17]

Answer:

False.

Explanation:

The description provided matches better with Software performance testing, and shouldn't be confused with a benchmark.

In computing, a benchmark is a tool or software designed to measure the average performance of another program, by running several tests and trials against it.

A performance testing is designed to measure the performance and responsiveness of a computer system (not a program) under a heavy workload.

8 0
3 years ago
Other questions:
  • You asked your colleague to provide feedback on a blog post you recently wrote. When they sent you their feedback, they made edi
    10·1 answer
  • An extranet is like an intranet except that it allows company employees access to corporate Web sites from the ______
    13·1 answer
  • In the United States, everyone is guaranteed work true or false
    13·1 answer
  • Which type of microscope can only be used to view non-living specimens?
    10·2 answers
  • By the 1990s, ______________ technology enabled one person operating a desktop computer to control most—or even all—of these fun
    8·2 answers
  • Why might you receive a tax refund from the irs
    6·1 answer
  • What are the OSHA construction standards also called ?
    10·1 answer
  • Cual es la importancia de aplicar los pasos en el modelo de diseño en las actividades académicas?
    14·1 answer
  • Video is a medium that's looks real anyways, but is real________________.
    10·1 answer
  • Are there any Potential Dangers in Artificial Intelligence?
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!