Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

answer the following question by modifying the code down below. please use c++ -----------------------------code starts here--------------------------------------------------- //System Libraries Here #include //I/O Library using namespace std;

answer the following question by modifying the code down below. please use c++

image text in transcribed

-----------------------------code starts here---------------------------------------------------

//System Libraries Here #include //I/O Library using namespace std;

//User Libraries Here struct TriMatx{ int size; //Represents the number of rows int *col; //Represents the column array, i.e. number of columns for each row int *indx; //Represents the index matrix which you can sort to use for display int **data;//Represents the data contents of the Triangular matrix };

//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 rowSize; //Number of Rows in the Array TriMatx *triMt;//Triangular Matrix Structure //Input or initialize values Here cout>rowSize; triMt=fillMat(rowSize);//Dynamic triangular array

//Output Located Here coutcol,triMt->size); cout

//Deallocate the structure destroy(triMt); //Exit return 0; }

//Create this function TriMatx *fillMat(int rows){ TriMatx *triMt=new TriMatx; triMt->size=0; triMt->col=0; triMt->indx=0; triMt->data=0; return triMt; }

//Create this function void prntAry(TriMatx *triMt){ }

//Create this function void mrkSort(TriMatx *triMt){ }

void destroy(TriMatx *triMt){ //Delete every row of the triangular array for(int i=0;isize;i++){ delete []triMt->data[i]; } //Delete the pointers delete []triMt->data; delete []triMt->col; delete []triMt->indx; delete triMt; }

void prntAry(int *a,int n){ if(a==0)return; for(int i=0;i cout

int mrkRand(int seed){ //Xn+1 = (aXn + c) mod m //where X is the sequence of pseudo-random values //m, 0

-----------------------------------expected outcome -------------------------------------------

image text in transcribed

Complete the code. There are 3 functions that need to be modified to output the desired result. Fill the columns first with random 1 digit values, then fill the data array with random 1 digit values. // Create this function TriMatx *fillMat(int rows) { TriMatx *triMt=new TriMatx; triMt->size=0; triMt->col=0; triMt->indx=0; triMt->data=0; return triMt; } //Create this function void prntAry(TriMatx *triMt){ } //Create this function void mrkSort(TriMatx *triMt } Expected Output Input-the-Number-of-Rows-in-the-Arrayd The-ColumnArraySized 3-4-1-8-2-6-2-5-7.9. The-Triangular-Array-Sortede . 13-2-d .9.3 19-4-3-4 9-8.2.3. 7.1-4.4.9. |3-9-2-4-5-4.4 13-5-8-3-8-6-7.d 9-4-1-5.4.7.9.7. 5-5-6-2-4-7-6-6-1-4

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Machine Performance Modeling Methodologies And Evaluation Strategies Lncs 257

Authors: Francesca Cesarini ,Silvio Salza

1st Edition

3540179429, 978-3540179429

More Books

Students also viewed these Databases questions

Question

How are glass products formed or shaped?

Answered: 1 week ago