Question
that didnt work it is still gives me wrong input ,try the input and in the phote of test case 1 and 3 shows what
that didnt work it is still gives me wrong input ,try the input and in the phote of test case 1 and 3 shows what the correct out put should be
this is the original code
void ArrPrint (const string phrases [][ColumnSize], int RowSize, bool dir, bool oppo) { if (dir == 0) { if (oppo == 0) { for (int i = 0; i = 0; i--) { for (int j = 0; j = 0; j--) { for (int i = 0; i
string ArrMax (const string phrases [][ColumnSize], int RowSize, int rowNum, int colNum) { string max = ""; if (rowNum == -1 && colNum == -1) { for (int i = 0; i max) { max = phrases[i][j]; } } } } else if (rowNum == -1) { for (int i = 0; i max) { max = phrases[i][colNum]; } } } else if (colNum == -1) { for (int j = 0; j max) { max = phrases[rowNum][j]; } } } return max; }
///////
this is the fixed code but has the same problem
void ArrPrint (const string phrases [][ColumnSize], int RowSize, bool dir, bool oppo) { if (dir) { if (!oppo) { for (int i = 0; i
for (int i = RowSize - 1; i >= 0; i--) { for (int j = 0; j
for (int j = 0; j
for (int j = ColumnSize - 1; j >= 0; j--) { for (int i = 0; i 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 =1 ), the largest string in the 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. Sample Testcase 0 (not graded, for student use only): Input: 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 3 (not graded, for student use only): Input: Suppose main calls ArrPrint as ArrPrint(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: Qatar The hosted weather the is World really Cup cold Compilation suceeded Grading sample test cases .... sample test case 0 failed (incorrect output) sample test case 1 succeeded sample test case 2 succeeded sample test case 3 failed (incorrect output) sample test case 4 succeeded sample test case 5 succeeded sample test case 6 succeeded Grading secret test cases .... secret test case 0 failed (incorrect output) secret test case 1 succeeded secret test case 2 succeeded secret test case 3 failed (incorrect output) secret test case 4 succeeded secret test case 5 succeeded secret test case 6 succeeded
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started