Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can you please write the int main and please dont change the original functions and explain . HW7: Two-Dimensional Arrays You are required to write

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed Can you please write the int main and please dont change the original functions and explain .

HW7: Two-Dimensional Arrays You are required to write two functions called ArrPrint and ArrMax according to the following specifications: - Function ArrPrint: takes as input a two-dimentional array of type string (i.e. phrases), an integer variable (i.e. Rowsize), and two boolean variables (i.e. dir and oppo). This function is responsible for printing the array row-by-row (when dir =0 ) or column-by-column (when dir =1 ) such that each row/column is printed in normal order (when oppo =0 ) or in reverse order (when oppo =1 ). Notice that the function should print a single-space after each element. - Function ArrMax: takes as input a two-dimentional array of type string (i.e. phrases) and three integer variables (i.e. RowSize, rowNum, and colNum). This function is responsible for returning the largest string in the row specified by rowNum (when colNum = column specified by colNum (when rowNum = -1), or the largest string in the entire array phrases (when rowNum = -1 and colNum = 1 ). Do not write and submit the main subroutine, or any include statments, these are already written and hidden from you. However, if you want to test your solution in any IDE (e.g., CodeBlocks, CLion, onlinegdb.com), then you will need to write your own main there for testing purposes. IMPORTANT NOTES - Do not change the given functions headers. - Do not add any cout statements inside the function ArrMax. - Assume a global constant variable called ColumnSize is defined to determine the number of columns in the two-dimentional array. - The parameter RowSize in both functions represents the number of filled rows in the two-dimentional array. - Your code should work correctly regardless the values of ColumnSize and RowSize. Suppose main calls ArrPrint as ArrPrint(phrases, 2,0,1) and phrases is initialized as \{\{"The", "weather", "is", "really", "cold"\}, \{"Qatar", "hosted", "the", "World", "Cup"\}\}, then the output would be: Function Output: cold really is weather The Cup World the hosted Qatar Sample Testcase 1 (not graded, for student use only): Input: Suppose main calls ArrPrint as ArrPrint(phrases, 2,1,0) and phrases is initialized as \{\{"The", "weather", "is", "really", "cold"\}, \{"Qatar", "hosted", "the", "World", "Cup"\}\}, then the output would be: Function Output: The Qatar weather hosted is the really World cold Cup Sample Testcase 5 (not graded, for student use only): Input: Suppose main calls ArrMax as ArrMax(phrases,2,-1,3) and phrases is initialized as {{ "The", "weather", "is", "really", "cold" },{" Qatar", "hosted", "the", "World", "Cup"\}\}, then the output would be: Function Output: really Sample Testcase 6 (not graded, for student use only): Input: Suppose main calls ArrMax as ArrMax(phrases,2,-1,-1) and phrases is initialized as {{ "The", "weather", "is", "really", "cold"\}, \{"Qatar", "hosted", "the", "World", "Cup"\}\}, then the output would be: Function Output: weather 123456789voidArrPrint(conststringphrases[][ColumnSize],intRowsize,booldir,booloppo){//Addyourcodehere}stringArrMax(conststringphrases[][ColumnSize],intRowsize,intrownum,intcolNum){//Addyourcodehere}

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

More Books

Students also viewed these Databases questions