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
Vinvika [58]
2 years ago
15

9.11: Array Expander

Computers and Technology
1 answer:
vodka [1.7K]2 years ago
3 0

The Array Expander is an illustration of arrays and functions.

  • Arrays are variables that stores multiple values
  • Functions are named statements that are executed when called

<h3>The Array Expander program </h3>

The Array Expander program written in C++, where comments are used to explain each action is as follows:

#include <iostream>

using namespace std;

//This declares the Array Expander function

int* ArrayExpander(int *oldArr, int size){

   //This declares the new array

   int *newArr = new int[size * 2];

//This iteration sets values into the new array

   for (int i = 0; i < size * 2; i++) {

       if(i < size){

           *(newArr+i) = *(oldArr+i);

       }

       else{

           *(newArr+i) = 0;

       }

   }

//This returns a pointer to the new array

   return newArr;

}

//The main method begins here

int main(){

//This declares the length of the array, N

   int N;    

//This gets input for N

   cin>>N;

   int initArr[N];

//If N is between 1 and 50

   if(N > 0 && N <=50){

//This iteration gets values for the array

       for(int i = 0; i<N; i++){

           cin>>initArr[i];

       }

//This calls the Array Expander function

   int *ptr = ArrayExpander(initArr, N);

//This iteration prints the elements of the new array

   for (int i = 0; i < N*2; i++) {

       cout << ptr[i] << " ";

   }

   }

  return 0;

}

Read more abou C++ programs at:

brainly.com/question/27246607

You might be interested in
The OSI model is currently the most widely implemented network model used to develop and build networks of any size, including t
natta225 [31]

Answer:

The correct answer to the following question will be "False".

Explanation:

  • The Open Systems Interconnection model is a conceptualization that describes and vastly simplifies a telecommunication or computer system's communication features, regardless of its inner structure and technologies underlying them.
  • This model aims is to direct manufacturers and creators so that they would modularize with the digital communication devices and computer programs they build, and to promote a consistent context that defines the roles of a network or telecom device.

Therefore, the given statement is false.

7 0
3 years ago
What happens when i expose a disk to magnetic fields?​
lesya692 [45]

Answer:

When exposed to the powerful magnetic field of a degausser, the magnetic data on a tape or hard disk is neutralized, or erased. Degaussing is the guaranteed form of hard drive erasure, as such; it serves as the standard method of data destruction.

Explanation:

3 0
3 years ago
What are the main types of reading tools? Check all that apply. please HELP​
vovangra [49]

Answer:

Comprehension

reference

3 0
3 years ago
When using the text command, what needs to be around the word or words you<br> want to appear?
AysviL [449]

Answer:

In most programming languages "" are required around text.

Explanation:

Python: print("text")

HTML: <p>text</p>

C++: int Main() {

cout << "text" << endl;

}

Lua: print("text")

8 0
3 years ago
To annotate a document with a remark for another reviewer to address, select the _____ feature. comments track changes annotatio
kupik [55]
Select the comments feature.

We use comments in our documents to track issues for follow up or make suggestions to other people. A comment is inserted inside a balloon or a box that appears in the document's margins. Whatever the situation you may be in, you can easily add comments in a word document.

 



6 0
3 years ago
Read 2 more answers
Other questions:
  • On sites that use "cloud computing," how is your information being stored?
    13·1 answer
  • Which searching method requires that the list be sorted?
    5·1 answer
  • T F The exit function can only be called from main .
    10·1 answer
  • “identify the skill in the following scenario” :
    6·2 answers
  • Does anyone know the answer for this? I’m extremely confused.
    8·2 answers
  • What is meant by the phrase "backing up your data"?
    15·1 answer
  • Identify the benefit of modeling to communicate a solution.
    10·1 answer
  • Here is a list of storage devices:
    5·1 answer
  • Ken has discovered that a vice president of his company has been using his computer to send data about a new product to a compet
    15·1 answer
  • Can a dod activity enter into a service contract for a military flight simulator without getting a waiver from the secretary of
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!