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]
3 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]3 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
Boolean logic deals with statements having one of _____ values.
Alexxandr [17]

Answer:

2 values

Explanation:

boolean statements can only be True or False

6 0
3 years ago
Which of the following is the best example of potential energy?
Otrada [13]
<span>Potential energy is the energy that is stored in an object due to its position relative to some zero position ,so the answer is " A runner positioned at the start line"</span>
6 0
3 years ago
Read 2 more answers
PLEASE HELP
Rainbow [258]

Explanation:

examples

Area= Side Squared

area =square root of 49cm Squared =Square root of S Squared

A=7cm Squared

6 0
3 years ago
Where would you go to access frequently used icons?
trapecia [35]

Answer:

b

Explanation:

4 0
3 years ago
Read 2 more answers
DRU is a small brokerage house that enables its clients to buy and sell
Rudik [331]

The complete question rather reads;

DRU is a small brokerage house that enables its clients to buy and sell

stocks over the Internet, as well as place traditional orders by phone or Fax. DRU has just decided to install a new e-mail package. One vendor offering an SMTP-based two-tier client-server architecture. The second vendor is offering a Web-based e-mail architecture. DRU doesn't understand either one but thanks the Web-based one should be better because, in their words, "the Web is the future".

<u>(a) Briefly explain to DRU management, in layperson's terms, the difference between the two.</u>

<u>(b) Outline the pros and cons of the two alternatives and </u>

<u>(c) Recommend to DRU about which is better</u>

<u>Explanation:</u>

a) SMTP stands for Simple Mail Transfer Protocol. Thus, put simply an SMTP-based two-tier client-server architecture is a package that involves using a client-server provider like Outlook. This implies that Outlook provides the client with his own unique PO Box (server) so to speak.

While the Web-based e-mail architecture enables the DRU access to online mail platforms like G-mail with little server customisation features.

b. The Web-based e-mail architecture is good for personal email activities because of its ease of operation, however, it does not provide top security and customisation features. While an SMTP-based two-tier client-server architecture allows for unique server customisation with added security features as well be suitable for larger organisational work. Although a disadvantage is that it may cost more and quite a complex process to learn.

c) Since DRU is a growing firm the SMTP-based two-tier client-server architecture would be recommended as this would provide it will efficient customer service delivery.

6 0
3 years ago
Other questions:
  • When you see a yield sign what do you do?
    8·1 answer
  • Excel has more than 400 additional functions that perform just about every type of calculation you can imagine. Answer
    6·1 answer
  • What information is kept in the cached lookups folder for a dns server?
    9·1 answer
  • How can a user view the options for Junk E-mail?
    11·2 answers
  • Personality traits such as thoughtfulness, empathy, self-control, and goal orientation belong to the _____ category.
    5·2 answers
  • A person is trying to remember a list of 12 different items:
    6·2 answers
  • Which of the following is not a computer application?
    10·2 answers
  • Write the code for the method getNewBox. The method getNewBox will return a GiftBox that has dimensions that are m times the dim
    14·1 answer
  • . In an airport, a system consisting of sensors, bar code readers and remote controls is MOST LIKELY used for
    12·2 answers
  • A mobile operating system is stored on a ___ chip.​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!