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
A measure of technological evolution is the web year which is
olya-2409 [2.1K]
The correct answer is: <span>1/7 of a calendar year

</span>A Web year has been said to be the length of time it takes for Internet technology to evolve as much as technology in another environment might evolve in a calendar year. The term was coined at a time when the Internet and Web technology and culture were progressing at a phenomenal rate. 

<span>The term is sometimes attributed to Lou Gerstner, then head of IBM. According to Larry Kunz, then the editor of IBM's Network Connection, the idea of a Web year was introduced by an unnamed female colleague in 1996. </span>

<span>In a 1996 interview in the WWW Journal, Tim Berners-Lee, chief inventor of the Web technologies, said: "What is a Web year now, about three months? And when people can browse around, discover new things, and download them fast, when we all have agents - then Web years could slip by before human beings can notice." When the interviewer suggested that such a pace would "take a physical toll" on people who work on the Web, Berners-Lee agreed that was true, but added that they would also "be able to live for three or four hundred Web years, which will be very exciting."</span>
7 0
3 years ago
2) A simple operating system supports only a single directory but allows it to have arbitrarily many files with arbitrarily long
puteri [66]

Answer:

Yes it can

Explanation:

The answer is Yes something approximating a hierarchical file system can be simulated. A way to carry out this simulation is through appending to each file name the name of the directory that contains it. But an offside to it is that it may end up becoming too complex to manage because the file name may be too long.

8 0
3 years ago
Digital data is _____ and analog information is _____.
Liula [17]
Digital data is discrete and analog information is continuous.
6 0
4 years ago
Where do you see script fonts? Where do you see Display or Ornamental fonts?
STatiana [176]

Answer:

Script typefaces are based upon the varied and often fluid stroke created by handwriting. They are generally used for display or trade printing, rather than for extended body text in the Latin alphabet. Some Greek alphabet typefaces, especially historically, have been a closer simulation of handwriting.

Explanation:

4 0
3 years ago
________________ are piece of programs or scripts that allow hackers to take control over any system.
Ber [7]

Answer:

Exploits

Explanation:

Exploits can be explained to be a piece of programmed softwares or scripts that can give hackers the opportunity to take control over any system and exploit this system's vulnerabilities. The vulnerability scanners that hackers use includes, Nessus, Nexpose e.tc.

They use these scanners above to search for vulnerabilities.

3 0
3 years ago
Other questions:
  • In python:
    8·1 answer
  • Write a program that calculates and displays a person’s body mass index (BMI). The BMI is often used to determine whether a pers
    11·1 answer
  • When using IPsec, how can you ensure that each computer uses its own private key pair?
    12·1 answer
  • Daniel owns a construction company that builds homes. To help his customers visualize the types of homes he can build for them,
    6·1 answer
  • True or false Encryption prevents hackers from hacking data?
    8·1 answer
  • True or false: It can take some time for the labs to load once you click “start lab.”
    7·1 answer
  • Select the correct answer.
    9·1 answer
  • Write a program to change background colour of your visual basic form with any 3 different events.​
    15·2 answers
  • PLZ PLZ PLZ PLZ HELP I ONLY HAVE 5 MINUTES IT SAYS THE SUBJECT IS COMPUTERS AND TECHNOLOGY BUT ITS ACTUALLY MEDIA LIT
    5·1 answer
  • What type of attack occurs when the threat actor snoops and intercepts the digital data transmitted by the computer and resends
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!