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
Shadow and highlight create depth (3D).<br> TRUE OR FALSE
tamaranim1 [39]

Answer:

true because then it would be like not popping out

7 0
3 years ago
This question refers to a standard deck of playing cards. If you are unfamiliar with playing cards, there is an explanation in P
Norma-Jean [14]

Answer:

Explanation:

Number of ways to select 10 girls in 35C₁₀

Number of ways to select 10 boys in 35C₁₀

Total Number of ways to select is 35C₁₀ x 35C₁₀

4 0
3 years ago
Read 2 more answers
Where is the best place to self learn c++ or c# that is free?
Elina [12.6K]

Answer:

udemy

Explanation:

Hello guys, you might know that C++ is one of the most popular and powerful object-oriented programming languages and if you want to do low-level stuff then it’s the best language to start with.

You will find applications written in C++ on a wide range of fields like embedded programming, server-side application, gaming, and even high-frequency trading applications. Most of the complex software like Operating Systems, Database Management Systems, and Powerful trading systems are written in C++.

While many of us have learned to program by using C and C++, let me honest with you learning C++ is challenging. There are many areas that are tough to grasp like points but you will learn them slowly and that’s where these free C++ courses will help you.

There is no doubt that learning C++ will open several opportunities for you. There is a huge demand for good C++ developers, especially in the area of high-frequency trading where every microsecond matter and power of C++ is absolutely needed.

C++ is the language which provides the best of both world, it allows you to use OOP to manage the complexity of software but at the same time, it also allows you to get close to your machine and access all of your computer’s hardware, which is not easily possible for other object-oriented languages like Java or Python.

That’s the reason C++ is heavily used for writing native device drivers, high-end desktop games and complex artificial intelligence programs where you need high performance.

In this article, I am going to share with you some of the best and free courses to learn C++ online at your own time and place and free of cost. You can use these courses if you are starting with programming or you have some experience in coding but not familiar with C++.

4 0
3 years ago
Read 2 more answers
Which strategy should individuals working in a diverse workplace adopt?
yawa3891 [41]
B.Interact more with people from different backgrounds. this is correct because that would help people get to know each other better.

Hope this helps:)
4 0
3 years ago
Read 2 more answers
If you have a long title and need it to span several cells, you can use what?
Marat540 [252]
I believe this is Insert Controls
5 0
3 years ago
Other questions:
  • A software program that allows a programmer to type in code. modern versions usually make it easy to format the code on the scre
    13·1 answer
  • What education and training is required to be an applications software engineer?
    9·1 answer
  • In apersuasive message, opposing ideas should be:
    13·1 answer
  • From which type of data storage does the CPU load information for processing during normal operation?
    14·1 answer
  • Will mark brainliest! What does this code do? What kind of code is this called?
    15·1 answer
  • How do i code........​
    6·2 answers
  • Write modified code that will generate a random number between 0 and 255 when a button is pressed and will write the number to t
    14·1 answer
  • A task-oriented leader is ideal for a creative workplace.
    8·2 answers
  • Carlie was asked to review a software project for her company to determine specific deadlines. Which part of project management
    9·2 answers
  • Phân tích cạnh tranh của cocacola và pepsi
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!