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
The ______________________ is the part of the ip address that is the same among computers in a network segment.
kozerog [31]
The answer is 
External IP address.
4 0
3 years ago
Witch of the following attributes of a website indicates a more reliable source for information
Arada [10]
The only one of those I would trust is the site ending with EDU I hope this helps you.
4 0
3 years ago
____________________ are compromised systems that are directed remotely (usually by a transmitted command) by the attacker to pa
Talja [164]

Answer: Zombies

Explanation: Zombie is a computer device that is responsible for the compromising the system and making it prone to several destruction such as the Trojan horse virus,hackers and other viruses as well. Zombie makes the computer system to get malfunctioned easily ,that is without much security and various malicious functions can be performed.They basically act as the infected computer .

6 0
3 years ago
Read 2 more answers
Servers that exist within a data center that is publicly accessible on the internet are referred to as on-premises servers.
adoni [48]

Servers that exist within a data center that is publicly accessible on the internet are referred to as on-premises servers: b. false.

<h3>What is a server?</h3>

A server can be defined as a dedicated computer system that is designed and developed to provide specific services to other computer devices or programs, which are commonly referred to as the clients.

<h3>What is an on-premises server?</h3>

An on-premises server can be defined as a type of server that are privately owned by a company or individuals, which must be managed and maintained individually.

In conclusion, servers that exist within a data center that is not publicly accessible on the internet are generally referred to as on-premises servers.

Read more on servers here: brainly.com/question/27960093

#SPJ1

7 0
1 year ago
Adding _____ will allow the user to create text as it will often appear in publications with multiple articles, such as a newspa
mart [117]
Does applications make sense <span />
5 0
3 years ago
Read 2 more answers
Other questions:
  • At the dsl local carrier's office, the __________ demultiplexes the data streams and converts them into digital data.
    10·1 answer
  • If you need to multiply 400, 2, and 1 ½, what would you type on the numeric keypad?
    9·2 answers
  • Technician A says that automotive engine blocks are usually classified by the number of cylinders the block. Technician B says t
    9·1 answer
  • Write a method named circleArea that accepts the radius of a circle as a parameter (as a real number) and returns the area of a
    12·1 answer
  • The person in charge of recording the sound should always
    15·1 answer
  • Given the following function definition
    13·1 answer
  • Which option is referred to by the Reports Due tag?
    7·1 answer
  • Part 2: a) Write VHDL code for a top module that invokes necessary components to display the four decimal digits on four seven-s
    5·1 answer
  • for java ?(Business: check ISBN-13)ISBN-13 is a new standard for identifying books. It uses 13 digits d1d2d3d4d5d6d7d8d9d10d11d1
    9·1 answer
  • What are the differences between a cursor, insertion point and mouse pointer?​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!