Question: If we create a stockDB class which stores variable number of stocks in a dynamic stock array. Complete the minimum stockDB.h class definition such that
-
If we create a stockDB class which stores variable number of stocks in a dynamic stock array. Complete the minimum stockDB.h class definition such that
stockDB frank(5), obama(700); // frank can have at most 5 stocks, obama 700 max
class stockDB {
-
(3pt) Write the implementation code (cpp) that supports frank = obama;
-
(3pt) Further assume that stock has operator< overloaded and there is a global swap(stock&, stock&) function. Complete the following implementation code for stockDB selection sort.
void stockDB::selectionSort() {
-
Add additional code below to cause a dangling pointer issue.
int * a = new int(5);
int * b = a;
-
Given the declaration int * d = new int[5]; Check ALL statements that prints out the address of the 2nd elements in d array
-
cout << d + 1;
-
cout << d + 4;
-
cout << &d[1];
-
cout << &d+4;
-
cout << d++; // this is a bit tricky
-
-
Is the following code correct? If yes, whats the output? If no, whats wrong?
int *p; //Line 1
int *q; //Line 2
p = new int; //Line 3
*p = 43; //Line 4
q = p; //Line 5
*q = 52; //Line 6
delete q; //Line 7
cout << *p << " " << *q << endl; //Line 8
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
