Question: Create an Ordered Triangular Matrix (C++) Take the template and complete creation and ordering of the Triangular Matrix. //Complete the following Functions int**fillAry(int *,int); //Randomly
Create an Ordered Triangular Matrix (C++)
Take the template and complete creation and ordering of the Triangular Matrix.
//Complete the following Functions
int**fillAry(int *,int); //Randomly fill a triangular array
void prntAry(int **,int *,int *,int);//Print a triangular array
-------------------------------------------------------------------------------------------------------------
//System Libraries Here #include
//User Libraries Here
//Global Constants Only, No Global Variables //Like PI, e, Gravity, or conversions
//Function Prototypes Here int mrkRand(int=1
//Program Execution Begins Here int main(int argc, char** argv) { //Declare all Variables Here int *col; //Pointer to column array int *indx; //Index Array to the Sort Routine int **trangl; //Pointer to triangular array int rowSize; //Number of Rows in the Array //Input or initialize values Here cout>rowSize; indx=fillIdx(rowSize); //Index used for Database Sort col=fillAry(rowSize); //Dynamic 1-D array,#Columns in each row trangl=fillAry(col,rowSize);//Dynamic triangular array //Output Located Here cout
//Deallocate the array destroy(trangl,col,indx,rowSize); //Exit return 0; }
//Modify this Function for unequal number of columns per row //Input rows -> Number of rows // col -> Column array size n with number of columns in each row //Output // array -> 2D Triangular Array/Matrix int **fillAry(int *col,int rows){ int **array=new int*[rows]; for(int i=0;i //Modify this Function for unequal number of columns per row //Input n -> Number of rows // col -> Column array size n with number of columns in each row // array -> 2D Triangular Array/Matrix void prntAry(int **array,int *col,int *indx,int rows){ for(int i=0;i void mrkSort(int *array,int *indx,int size){ for(int pos=0;pos void destroy(int **a,int *c,int *indx,int n){ //Delete every row of the triangular array for(int i=0;i void prntAry(int *a,int n){ for(int i=0;i int *fillAry(int n){ int *array=new int[n]; for(int i=0;i int *fillIdx(int n){ int *array=new int[n]; for(int i=0;i int mrkRand(int seed){ //Xn+1 = (aXn + c) mod m //where X is the sequence of pseudo-random values //m, 0 ---------------Expected output----------------- -------------------- please show the whole modified code (MUST MATCH EXACTLY THE EXPECTED OUTPUT) thank you
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
