Question: Define a class which has a constructor, a member variable, two member functions, and a destructor. The member variable is an integer pointer. In the

 Define a class which has a constructor, a member variable, two

Define a class which has a constructor, a member variable, two member functions, and a destructor. The member variable is an integer pointer. In the constructor, use this pointer to dynamically allocate an integer array, the array size is decided by the constructor parameter (e.g. int n). The two member functions are: prime_count0 and prime_check0, the first returns how many prime numbers are in the array and the second is to check if a number is prime or not. In the destructor, deallocate the dynamic array memories through the pointer. In main0, declare and assign n using cin or rand(), then declare an object using the class defined above and pass n as its constructor parameter, then call its member function prime_count0 to output how many numbers in the array a prime In this homework, you need to team with a classmate and use pair programming to help each other to enhance programming skills: for each program, one write the program (driver) and the other verifies whether the writing is correct or not (navigator). Please take turns to write and verify (e.g. in program 1, person A writes the code and person B check it; in program 2, person B writes the code and person A checks it). State in the comments who is the driver and who is the navigator

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!