Question: 1) a) The following code was written to declare a dynamic two-dimensional array with 10 rows and 4 columns , but it is incorrect !

1)

a) The following code was written to declare a dynamic two-dimensional array with 10 rows and 4 columns, but it is incorrect! Correct it below.

int **matrix = new int matrix[10];

int i;

for (i = 0; i < 4; i++)

matrix[i] = new int[10];

b) Write the code to free (deallocate) the two-dimensional array from part a) above.

2)

Here is a class

class movieInfo

{

private:

int numActors; //number of Actors on the list

string * actorList; //holds all the actor names

string director;

public:

void printActors() const; //prints all the actors

void readActors(); //gets actor names from cin

void setDirector(string); //sets the director name

string getDirector() const; //returns the director name

movieInfo(); //sets empty actorList

movieInfo(int); //sets numActors to int parameter

a ) Write the prototype and defintion for a member function called sharesDirector. This function returns true if two movies have the same director and returns false otherwise.

prototype:____________________________________________________________

definition:

b) Write the prototype and defintion for a member function calles sharesActors. This function returns the number of shared actors (i.e. the count of actors that are in both movies.) If there are no actors that are in both movies, then the function returns a zero.

prototype:____________________________________________________________

definition:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!