# Q Write Program Perform Various 2d Array Operations C Java First Use Populatearray Functio Q25012125

Q: Write a program that will perform various 2D arrayoperations. ( C++! not Java)

First, use the populateArray function thatwe’ve used in class to populate a 10×10 array with random numbersin the range of 1-1000. Then, create and populatea second 10×10 array using the same function.

Create a third 10×10 array. Write a functionthat has three 10×10 arrays as its parameters. Your function willsimply add corresponding elements in array1 and array2 and placethe total in array3. For example:

array3[3][5] = array1[3][5] + array2[3][5]

As another example, suppose these numbers below represent 2x2arrays. The third array is simply the sum of the correspondingelements in the first and second arrays:

array1: array2: array3: 3 5 6 8 9 13 4 11 10 3 14 14

Your function call would look something like this:

Next, write a function that takes a 2D array asits parameter. The function will return thehighest value in the 2D array. Similarly, write an additionalfunction that will return thesmallest value in the 2D array.

Make sure to use the printArray function thatwe’ve used repeatedly in class to print your 2D arrays.

Your output should look practically identical to this (ofcourse, I have different random numbers):

Array1: 18 380 962 263 14 328 712 960 813 467 832 922 710 331 188 682 105 795 194 851 521 159 766 983 788 739 589 695 112 3 235 500 488 657 840 182 464 290 623 709 253 282 295 799 376 225 93 153 493 885 697 865 159 818 24 67 23 320 994 491 252 709 405 947 501 378 98 757 181 681 406 451 822 255 579 556 833 759 360 466 588 104 695 362 837 839 526 276 694 688 968 172 34 209 564 903 80 895 406 90 Array2: 349 446 493 616 718 819 813 2 847 284 821 388 421 154 660 118 867 709 160 64 19 777 287 529 506 857 617 82 425 337 574 486 410 687 996 757 712 717 723 913 978 616 757 504 825 357 432 268 584 381 566 544 387 142 863 92 203 396 685 474 378 143 704 57 57 671 779 10 50 5 103 105 275 732 894 286 880 40 683 61 580 502 64 411 601 572 904 427 454 266 638 496 648 65 502 811 317 123 618 166 Array3: 367 826 1455 879 732 1147 1525 962 1660 751 1653 1310 1131 485 848 800 972 1504 354 915 540 936 1053 1512 1294 1596 1206 777 537 340 809 986 898 1344 1836 939 1176 1007 1346 1622 1231 898 1052 1303 1201 582 525 421 1077 1266 1263 1409 546 960 887 159 226 716 1679 965 630 852 1109 1004 558 1049 877 767 231 686 509 556 1097 987 1473 842 1713 799 1043 527 1168 606 759 773 1438 1411 1430 703 1148 954 1606 668 682 274 1066 1714 397 1018 1024 256 Array1 largest: 994Array1 smallest: 3Array2 largest: 996Array2 smallest: 2Array3 largest: 1836Array3 smallest: 159 Program ending.

printArray and populateArray here!

void populateArray(int tempArray[][COLS]) {

int temprand = 0;

for (int i = 0; i < ROWS; i++)

for (int j = 0; j < COLS; j++) {

temprand = (rand() % MAXRAND + 1);

tempArray[i][j] = temprand;

void printArray(int tempArray[][COLS]) {

for (int i = 0; i < ROWS; i++) {

for (int j = 0; j < COLS; j++)

cout << setw(5) << tempArray[i][j];

cout << endl;

0 replies