Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Below is a partially implemented C++ program that manages a dynamic array of WordFreq objects. Please implement the four functions highlighted in the main( ).

Below is a partially implemented C++ program that manages a dynamic array of WordFreq objects. Please implement the four functions highlighted in the main( ). You can either first declare the prototypes of these four functions above main() and then implement them below main(); or simply implement these functions above main( ) without declaring their prototypes separately. Submission instruction: copy and paste the following code into your submission and then insert your code. Please remember to include exception handling whenever you call the new operator in the constructArray( ) function.

 
#include  #include  using namespace std;
struct WordFreq{ //same as the second coding lab string word; int Freq; };
int main( ) { WordFreq *arrayWF=nullptr; int size=0; int capacity = 20; WordFreq wf = {Hello, 10};
 //the following function // (1) allocates a memory space capable to hold up to capacity WordFreq objects; and (2) each object is initially set to (,0) constructArray( arrayWF, size, capacity); 
 //the push_back() function inserts the WordFreq object wf to the back of the arrayWF. Please note that this function needs to allocate more memory if needed. for (int i=0; i<100; i++) push_back(arrayWF, size, capacity, wf); 
//the function below prints out all the WordFreq objects stored in arrayWF one at a time in the format of (word, freq) printArray(arrayWF, size);
//deallocate the memory space held by arrayWF deallocateArrayWF( arrayWF );
 return 0; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Managing Your Information How To Design And Create A Textual Database On Your Microcomputer

Authors: Tenopir, Carol, Lundeen, Gerald

1st Edition

1555700233, 9781555700232

More Books

Students also viewed these Databases questions

Question

=+6 Who is the peer of the IA ?

Answered: 1 week ago

Question

=+herself to in terms of equity with regard to this assignment?

Answered: 1 week ago

Question

=+ What typical employee will the IA compare him/

Answered: 1 week ago