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
iragen [17]
3 years ago
9

The pointer to the dynamic array is called data, and the size of the dynamic array is stored in a private member variable called

capacity. Write the following new member function: (C++ LANGUAGE)
void bag::triple_capacity( )
// Postcondition: The capacity of the bag's dynamic array has been
// tripled. The bag still contains the same items that it previously
// had.

Do not use the reserve function, do not use realloc, and do not cause a heap leak. Do make sure that both data and capacity have new values that correctly indicate the new larger array.
Computers and Technology
1 answer:
MatroZZZ [7]3 years ago
4 0

Answer:

Following are code to this question:

void bag::triple_capacity()//defining a method bag that uses the scope resolution operator to hold triple_capacity  

{

int* newArray = new int[3*capacity];//defining an array that holds capacity value

for(int x=0;x<capacity;x++)//defining for loop to hold array value

{

newArray[x] = data[x];//holding array value in newArray

}

delete[] data;//using the delete keyword to delete value in array  

data = newArray;//holding array value in data

capacity = capacity*3;//increaing the array size value

}

Explanation:

In this code, a method "bag" is declared that uses the scope resolution operator that holds the triple_capacity method, inside the method an array "newArray" is declared that uses the for loop to hold array value.

In the next step, the delete keyword is declared that delete data value and hold newArray value within it and at the last, it increases the capacity of the array.

You might be interested in
Which of these is a major mobile game developer?
Firlakuza [10]
Im thinking Zynga because it has tons of games
7 0
3 years ago
Read 2 more answers
Which of the following is a subsystem of computers providing access to the Internet and offering multimedia and linking capabili
lbvjy [14]
Answer is option C that is w.w.w.
6 0
3 years ago
Use System.DateTime along with System.Console to implement a simple C# program that does the following:_______.
Andre45 [30]

Answer:

5

Explanation:

I did it to and it was right

3 0
3 years ago
The location on the Word screen where text will be entered is known as the _____.
mixas84 [53]
Insertion point is represented by blinking vertical line
4 0
3 years ago
You have purchased a printer that has the capability to print in duplex mode so that users can print on both sides of a sheet of
fiasKO [112]

If you have purchased a printer that has the capability to print in duplex mode so that users can print on both sides of a sheet of paper. However, when users try to use this capability when they send a print job, documents are still printed on only one side. Then there might be a problem with (d) THE DUPLEX MODE NEEDS TO BE ENABLED ON THE DEVICE SETTINGS TAB IN THE PRINTER'S PROPERTIES.

Explanation:

  • If the duplex mode isn't enable on the printer setting, then the printer is still going to read that the output should come in a single page and not in the duplex mode.
  • When facing such a problem, the user should go to the "Device Settings" tab in the printer properties and change the required settings to print according to the users needs.

7 0
3 years ago
Other questions:
  • Theresa is a certified teacher. She just had a baby and would like to stay home, but still wants to teach. Which career would be
    11·2 answers
  • A communications system connecting two or more computers is called a(n) ________.
    7·1 answer
  • What can help establish the focus and organization it relies on? A) Plan B) programming C) organizing D) arranging
    5·2 answers
  • Seth is considering advertising his business using paid search results.What do you think makes paid search advertising so effect
    11·2 answers
  • This method of advertising is expensive but can be the most effective method.
    15·1 answer
  • 3.2 lesson practice edhesive ​
    6·1 answer
  • What is the first step to apply the line and page breaks options to groups of paragraphs in a Word document?
    10·2 answers
  • Where would you go to access frequently used icons?
    12·2 answers
  • You can easily merge files even if each file contains a different record layout. Group of answer choices True False
    9·1 answer
  • What is the duty of WHH? (white hat hackers)<br><br><br>ANY WHH HERE?<br>​
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!