Question: Pls help me complete this assignment. See below for previous code of this question. This is the code I got for previous 2 parts. If

Pls help me complete this assignment. See below for previous code of this question.

Pls help me complete this assignment. See below for previous code of

This is the code I got for previous 2 parts. If you can access my questions you can see my previous question post. it has first 2 parts. Pls help me complete this assignment.

//part 1

#include

#include

using namespace std;

int main()

{

double *list1, *list2;

int i, j, v;

int enteries = 20;

list1 = new double[enteries];

list2 = new double[enteries];

for (i = 0, j = 0; i

{

v = (j % 1024);

list1[i] = list2[i] = v;

}

cout

for (int i = 0; i

{

cout

list1++;

}

cout

for (int i = 0; i

{

cout

list2++;

}

cout

delete[] list1, list2;

return 0;

}

//output

this question. This is the code I got for previous 2 parts.

//part 2

#include

#include

using namespace std;

int mysort(int enteries, double *list);

void myprinting(int enteries, double *list1, double *list2);

int main()

{

double *list1, *list2;

int enteries = 20;

list1 = new double[enteries];

list2 = new double[enteries];

mysort(enteries,list1);

mysort(enteries, list2);

myprinting(enteries, list1, list2);

return 0;

}

int mysort(int enteries, double *list)

{

int i, j, v;

for (i = 0, j = 0; i

{

v = (j % 1024);

list[i] = v;

}

return 0;

}

void myprinting(int enteries, double *list1, double *list2)

{

cout

for (int i = 0; i

{

cout

list1++;

}

cout

for (int i = 0; i

{

cout

list2++;

}

cout

}

//output

DYNAMIC 2-DIMENSIONAL ARRAYs We have covered how to coafigure Z-dimensioaal dynamis ays inclass for matrix tppe applisations. We will explore this as well as the ue o nctionslitte this section of the lab Insert the follaning code jut before the "return 0,-im the main finction; don't ernove the previous code as we will be itMng those function urther If yoe lde usd the Wadows oper otte sysrea ten te obowe eode will geoeste tunubereflies of oRyut. ar more tha the defaltndows ceusol indo allass you to scroll back to sex. Yoa ca ncreasc the ber of lis you ae look back oa by cikg e te C icon on etop l of yuabl widoa to propeses.actige to de layon! ish Ou there yUE will see de "Scicea Butle site". datge d'heigr. o 200 ormore and press OK. You il have to close the wiadow and re ran your program to see the changes get sgplied Onee this is doac you wil be sble to leok biek on te presonsoat. If you see uiing a PC is the engineering lab you will need to do these stegs every tme you legin to the systeas, For those ning other operating cys ears, you may have to eloge other settings to do this Ask the iamene for belp. Those using "jdoodle", uhould be able to croll back = the cutprt to see all the rutIn. /1 5dd code hore to .11068 memory for ., 2 (4-0, j " o, .ew.."Laj i.., j ". L2,3327) 08-88-21 Lborseery #3 43 06-88-211 Laboratory #3 3 5 Fo the last set od tas Isb ave will quikly ene ss We waill use the example of eeaiples suobers lich are vern etrial ngtoerng. Add the following code sfher thenepace The code sbove for slleening and deleting tde mstrix cn be found in the lecture notes with the minor ditlerene that sows aad cols are variables in this case. Tlis code also inclades a loap which i sinato what we're seen beore which geerates random like data for or matrin,but shorter (we conld have uved a ested loop alremately). Yon will also have to add a anction which will print out the contents of thbe matrix before your main funetion. Ts should be anested loop which goes row by row grinting the contents of esch cokan Aher the column is done, you should go to the next line and the cose painting the ext row. Add an exta blank lne on the output afher you are done printing the matrix toelpyu identify the beginning ad end of the matrix ur Your function shonkl wse the rews, cols, and "m" pointer as arguments Write ONLY your function belom The first lne instructs the coapiler to use soane additional math fanctions: we are interested in square root. The secoed live ereates a cusieen datstype wch is sstracoare catiing 2 relbers Clis is from the lectores) his is also a global defnitioa since it is sot ithin ay funatias, The last line is a quickmacro which derermines the se o cotnplex ber we will ared thes in oar aiodfied seing retise Copy yor etang tortizg funct on wach operate! aan my of doubles =to tatr banction called mmycomplessort Chaage the detatypes of yoar listo "cenpesas well as yeur teapoenry vsble for strapping. YoEacc d to also ctuage your companc. lias so that it properly coauaes coaglex autaben. Use tbs oero abere to perfetti tbe mputide ealalition Wriv ONLY tbst line below You will ako need to ereste a new fuerioa for priating yone eoplex hst Do the ame by ehsnging the dstatypes of the fanction to corplex. In ocr to print a coaples vaie.youst peint the eal part Erut, tha de iueginny pa (with the sign showing)adish it off by addin ajto the end to isdicoe wheeh part is napaury. Look b ck at lab l tocc bow to make co t di Pirr the signa of Postive zumben. It sl ould look somathine like 1j" Write ONLY tepeetice of your new priting faction below Write ONLY the statenent whuch eals this Lastly ads the following oode juut befoee the "yeten0."inyour main facron: In your main codk. right afer you cal the Euestion to print ths coutents of ta matix, add code wlhish will. or each sow in the matrix, call your existing sorting routine to soet the eontents of each row from the lowest to the highest. Ealier when doing this with just "list2 we passed entries" dlist2" as the arguments to ou function. The arguments m this case should be "cok" anl . (ass unun :se counter you use). To verify that this works. cal] your function stoch prints the matrixgain tsee the two outpus difler coerectly. wnie ONLY the code foa this poetion below tae stahemmeats you added below DYNAMIC 2-DIMENSIONAL ARRAYs We have covered how to coafigure Z-dimensioaal dynamis ays inclass for matrix tppe applisations. We will explore this as well as the ue o nctionslitte this section of the lab Insert the follaning code jut before the "return 0,-im the main finction; don't ernove the previous code as we will be itMng those function urther If yoe lde usd the Wadows oper otte sysrea ten te obowe eode will geoeste tunubereflies of oRyut. ar more tha the defaltndows ceusol indo allass you to scroll back to sex. Yoa ca ncreasc the ber of lis you ae look back oa by cikg e te C icon on etop l of yuabl widoa to propeses.actige to de layon! ish Ou there yUE will see de "Scicea Butle site". datge d'heigr. o 200 ormore and press OK. You il have to close the wiadow and re ran your program to see the changes get sgplied Onee this is doac you wil be sble to leok biek on te presonsoat. If you see uiing a PC is the engineering lab you will need to do these stegs every tme you legin to the systeas, For those ning other operating cys ears, you may have to eloge other settings to do this Ask the iamene for belp. Those using "jdoodle", uhould be able to croll back = the cutprt to see all the rutIn. /1 5dd code hore to .11068 memory for ., 2 (4-0, j " o, .ew.."Laj i.., j ". L2,3327) 08-88-21 Lborseery #3 43 06-88-211 Laboratory #3 3 5 Fo the last set od tas Isb ave will quikly ene ss We waill use the example of eeaiples suobers lich are vern etrial ngtoerng. Add the following code sfher thenepace The code sbove for slleening and deleting tde mstrix cn be found in the lecture notes with the minor ditlerene that sows aad cols are variables in this case. Tlis code also inclades a loap which i sinato what we're seen beore which geerates random like data for or matrin,but shorter (we conld have uved a ested loop alremately). Yon will also have to add a anction which will print out the contents of thbe matrix before your main funetion. Ts should be anested loop which goes row by row grinting the contents of esch cokan Aher the column is done, you should go to the next line and the cose painting the ext row. Add an exta blank lne on the output afher you are done printing the matrix toelpyu identify the beginning ad end of the matrix ur Your function shonkl wse the rews, cols, and "m" pointer as arguments Write ONLY your function belom The first lne instructs the coapiler to use soane additional math fanctions: we are interested in square root. The secoed live ereates a cusieen datstype wch is sstracoare catiing 2 relbers Clis is from the lectores) his is also a global defnitioa since it is sot ithin ay funatias, The last line is a quickmacro which derermines the se o cotnplex ber we will ared thes in oar aiodfied seing retise Copy yor etang tortizg funct on wach operate! aan my of doubles =to tatr banction called mmycomplessort Chaage the detatypes of yoar listo "cenpesas well as yeur teapoenry vsble for strapping. YoEacc d to also ctuage your companc. lias so that it properly coauaes coaglex autaben. Use tbs oero abere to perfetti tbe mputide ealalition Wriv ONLY tbst line below You will ako need to ereste a new fuerioa for priating yone eoplex hst Do the ame by ehsnging the dstatypes of the fanction to corplex. In ocr to print a coaples vaie.youst peint the eal part Erut, tha de iueginny pa (with the sign showing)adish it off by addin ajto the end to isdicoe wheeh part is napaury. Look b ck at lab l tocc bow to make co t di Pirr the signa of Postive zumben. It sl ould look somathine like 1j" Write ONLY tepeetice of your new priting faction below Write ONLY the statenent whuch eals this Lastly ads the following oode juut befoee the "yeten0."inyour main facron: In your main codk. right afer you cal the Euestion to print ths coutents of ta matix, add code wlhish will. or each sow in the matrix, call your existing sorting routine to soet the eontents of each row from the lowest to the highest. Ealier when doing this with just "list2 we passed entries" dlist2" as the arguments to ou function. The arguments m this case should be "cok" anl . (ass unun :se counter you use). To verify that this works. cal] your function stoch prints the matrixgain tsee the two outpus difler coerectly. wnie ONLY the code foa this poetion below tae stahemmeats you added below

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