Question: Create a two dimensional array and initialize it with random integer values in between 1- 10. Your task is to do the followings; a) Write

Create a two dimensional array and initialize it with random integer values in between 1- 10. Your task is to do the followings;

a) Write a method second_Max_RowSum(T a[][], int rowSize) that will calculate and return the second maximum sum of rows.

b) Write a method sortRows that will sort the each Row of 2-D array into ascending order.

c) Write a method swap_Odd_Rows that will swap the values of odd rows.

Note:

Make its Header File, cpp File and I am Providing G-Tests, Your Program (Header File ) Should have to pass that G-Tests

#include "pch.h"

#include"../(address of headerfile)"

TEST(Matrix, T1) { int a[3][4] = {{3,2,0,1} ,{5,6,7,4} ,{9,8,3,11}}; int res[3][4] = { {0, 1, 2, 3} , {4, 5, 6, 7} ,{3,8, 9, 11}}; EXPECT_EQ(22, second_Max_RowSum(a,3,4)); int **expect=sortRows(a,3,4); for (int i = 0; i < 3; i++) { for (int j = 0; j < 4; j++) { EXPECT_EQ(res[i][j],expect[i][j]); } } //write test cases for swap odd rows by yourself }

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!