Question: Convert the Dynamic _ 1 D _ 2 D _ Arrays folder to utilize all Vectors. #include #include #include #include using namespace std; / /

Convert the Dynamic_1D_2D_Arrays folder to utilize all Vectors.
#include
#include
#include
#include
using namespace std;
//User Libraries Here
//Global Constants Only, No Global Variables
//Like PI, e, Gravity, or conversions and Array Dimension
//Function Prototypes Here
void prntAry(const int *,int,int);
void prntAry(int **,int,int);
int *fillAry(int,int,int);
int **fillAry(int,int);
void fillAry(int **,int *,int,int);
void destroy(int **,int);
void fillAry(int **,int *,int,int,int);
void swap(int &,int &);
void smlLst(int [],int,int);
void mrkSort(int [],int);
//Program Execution Begins Here
int main(int argc, char** argv){
//Set the random number seed
srand(static_cast(time(0)));
//Declare all Variables Here
int rowsize=4;//Row size for both 1 and 2 D arrays
int colsize=3;//The column size for a 2 dimensional Array
int *array;
int *brray;
int *crray;
int **table;
int lowRng=100,highRng=999;
int perLine=4;
//Fill each parallel array
array=fillAry(rowsize,highRng,lowRng);
brray=fillAry(rowsize,highRng/10,lowRng/10);
crray=fillAry(rowsize,highRng/100,lowRng/100);
//Sort the array the for all positions
mrkSort(array,rowsize);
mrkSort(brray,rowsize);
mrkSort(crray,rowsize);
//Fill the 2-D array
table=fillAry(rowsize,colsize);
fillAry(table,array,rowsize,0);
fillAry(table,brray,rowsize,1);
fillAry(table,crray,rowsize,2);
//Print the values in the array
prntAry(array,rowsize,perLine);
prntAry(brray,rowsize,perLine);
prntAry(crray,rowsize,perLine);
prntAry(table,rowsize,colsize);
//Cleanup
delete []array;
delete []brray;
delete []crray;
destroy(table,rowsize);
//Exit
return 0;
}
void destroy(int **a,int rows){
for(int row=0;rowa[i]){
swap(a[pos],a[i]);
}
}
}
void swap(int &a,int &b){
int temp=a;
a=b;
b=temp;
}

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 Programming Questions!