$29
Write a void function named smallSort2 that takes as parameters the addresses of three int variables and sorts the ints at those addresses into ascending order. For example if the main method has:
int a = 14;
int b = -90;
int c = 2;
smallSort2(&a, &b, &c);
cout << a << ", " << b << ", " << c << endl;
Then the output should be:
-90, 2, 14
The file must be named smallSort2.cpp.
Project 8.b
Write a void function called repeatArray that takes two parameters - a reference to a
pointer to a dynamically allocated array of doubles, and the size of that array. The
pointer is passed by reference because you want to change the value of the
pointer. The function should replace the array with one that is twice as large, with the
values from the original array appearing twice. For example, if array that was passed in
was {3.1, 4.2, 5.3}, then it should be replaced by {3.1, 4.2, 5.3, 3.1, 4.2, 5.3}. The
function should prevent any memory leaks. Remember to also prevent memory
leaks in the main you use for testing.
For example, it could be used like this:
double* myArray = new double[3];
for (int i=0; i<3; i++)
myArray[i] = (i+1)*2;
repeatArray(myArray, 3);
for (int i=0; i<6; i++)
cout << myArray[i] << endl;
delete []myArray;
The file must be named repeatArray.cpp.