3.1.1 Functions• createArray(array: int**&, numColumns: int*&, numRows: int& , input: std::string): void– If no previous arrays have been created, the passed-in parameters will be NULL. If apreviously created array was already stored there, the parameters will be non NULL. Ifthe passed-in parameters are not NULL, you may assume they follow the specificationsstated at the start of this section.– The passed-in string should be used to populate the variables.– Rows are split using a bar, |.– If no bars are present, then it means only one row in the array.– The values in each row are split using commas. You may assume that the values betweencommas will always be valid integers.– A row can also be an empty string. In this case, that row should be an array that has asize of 0.– You may assume that the input string will always follow these specifications, and you donot need to check whether the input is valid.• destroyArray(array: int**&, numColumns: int*&, numRows: int&): void– This will deallocate all of the passed in variables.– After this function is called, array and numColumns should be NULL, and numRowsshould be 0.• printArrayStructure(array: int**&, numColumns: int*&, numRows: int&): std::string– This function returns a string representing the structure of the array.– The string starts with the word “numRows”, followed by a space, then a colon, and thenanother space.– The number of rows is then appended to this string, with a newline after this.– For every row, the following is then appended:∗ The word “row”, followed by the row number that starts from 0 inside square brackets.After the second square bracket, there is a space, followed by a colon, followed by aspace.∗ After this, the number of columns for that row is appended.∗ For all rows except the last row, a new line is added to the end. printArray(array: int**&, numColumns: int*&, numRows: int&): std::string– This function returns a string representing the array.– Each row should be printed on its own line. Each line should end with a new line, exceptthe last row.– The elements in each row should be separated with a comma.– If the row has 0 columns, then an empty string should be used as the row.• addRow(array: int**&, numColumns: int*&, numRows: int&): void– This function should add a row to the end of the array.– The new row should have 0 columns.• addValueToRow(array: int**&, numColumns: int*&, numRows: int&, rowNumber: int, value:int): void– This function will attempt to add the passed-in value, to the end of the row indicated bythe passed-in rowNumber.– If the rowNumber is invalid, then this function does nothing.• removeRow(array: int**&, numColumns: int*&, numRows: int&, rowNumber: int): void– This function will attempt to remove a row from the array, indicated by the passed-inrowNumber.– If the rowNumber is invalid, then this function does nothing.• removeValueFromRow(array: int**&, numColumns: int*&, numRows: int&, rowNumber: int,value: int): void– This function will attempt to remove values from a row in the array.– All occurrences of the passed-in value should be removed from the row indicated byrowNumber.– If the rowNumber is invalid, then this function does nothing.• rowSum(array: int**&, numColumns: int*&, numRows: int&, rowNumber: int); int– This function returns the sum of the passed-in rowNumber.– If the rowNumber is invalid, then return -1.• rowAvg(array: int**&, numColumns: int*&, numRows: int&, rowNumber: int): float– This function returns the average of the passed-in rowNumber.– If the rowNumber is invalid or if the number of columns for that row is 0, then return -1. rowMax(array: int**&, numColumns: int*&, numRows: int&, rowNumber: int): int– This function returns the maximum element of the passed-in rowNumber.– If the rowNumber is invalid or if the number of columns for that row is 0, then return -1.• rowMin(array: int**&, numColumns: int*&, numRows: int&, rowNumber: int): int– This function returns the minimum element of the passed-in rowNumber.– If the rowNumber is invalid or if the number of columns for that row is 0, then return -1.
Question
3.1.1 Functions• createArray(array: int**&, numColumns: int*&, numRows: int& , input: std::string): void– If no previous arrays have been created, the passed-in parameters will be NULL. If apreviously created array was already stored there, the parameters will be non NULL. Ifthe passed-in parameters are not NULL, you may assume they follow the specificationsstated at the start of this section.– The passed-in string should be used to populate the variables.– Rows are split using a bar, |.– If no bars are present, then it means only one row in the array.– The values in each row are split using commas. You may assume that the values betweencommas will always be valid integers.– A row can also be an empty string. In this case, that row should be an array that has asize of 0.– You may assume that the input string will always follow these specifications, and you donot need to check whether the input is valid.• destroyArray(array: int**&, numColumns: int*&, numRows: int&): void– This will deallocate all of the passed in variables.– After this function is called, array and numColumns should be NULL, and numRowsshould be 0.• printArrayStructure(array: int**&, numColumns: int*&, numRows: int&): std::string– This function returns a string representing the structure of the array.– The string starts with the word “numRows”, followed by a space, then a colon, and thenanother space.– The number of rows is then appended to this string, with a newline after this.– For every row, the following is then appended:∗ The word “row”, followed by the row number that starts from 0 inside square brackets.After the second square bracket, there is a space, followed by a colon, followed by aspace.∗ After this, the number of columns for that row is appended.∗ For all rows except the last row, a new line is added to the end. printArray(array: int**&, numColumns: int*&, numRows: int&): std::string– This function returns a string representing the array.– Each row should be printed on its own line. Each line should end with a new line, exceptthe last row.– The elements in each row should be separated with a comma.– If the row has 0 columns, then an empty string should be used as the row.• addRow(array: int**&, numColumns: int*&, numRows: int&): void– This function should add a row to the end of the array.– The new row should have 0 columns.• addValueToRow(array: int**&, numColumns: int*&, numRows: int&, rowNumber: int, value:int): void– This function will attempt to add the passed-in value, to the end of the row indicated bythe passed-in rowNumber.– If the rowNumber is invalid, then this function does nothing.• removeRow(array: int**&, numColumns: int*&, numRows: int&, rowNumber: int): void– This function will attempt to remove a row from the array, indicated by the passed-inrowNumber.– If the rowNumber is invalid, then this function does nothing.• removeValueFromRow(array: int**&, numColumns: int*&, numRows: int&, rowNumber: int,value: int): void– This function will attempt to remove values from a row in the array.– All occurrences of the passed-in value should be removed from the row indicated byrowNumber.– If the rowNumber is invalid, then this function does nothing.• rowSum(array: int**&, numColumns: int*&, numRows: int&, rowNumber: int); int– This function returns the sum of the passed-in rowNumber.– If the rowNumber is invalid, then return -1.• rowAvg(array: int**&, numColumns: int*&, numRows: int&, rowNumber: int): float– This function returns the average of the passed-in rowNumber.– If the rowNumber is invalid or if the number of columns for that row is 0, then return -1. rowMax(array: int**&, numColumns: int*&, numRows: int&, rowNumber: int): int– This function returns the maximum element of the passed-in rowNumber.– If the rowNumber is invalid or if the number of columns for that row is 0, then return -1.• rowMin(array: int**&, numColumns: int*&, numRows: int&, rowNumber: int): int– This function returns the minimum element of the passed-in rowNumber.– If the rowNumber is invalid or if the number of columns for that row is 0, then return -1.
Solution
The question appears to be a detailed description of a set of functions for a programming assignment, likely in C++ given the syntax and use of pointers. Here's a brief summary of what each function should do:
-
createArray: This function takes a 2D array, an array of column sizes, a reference to the number of rows, and a string as input. It populates the array based on the string, where rows are separated by '|' and values within rows are separated by commas. -
destroyArray: This function deallocates all memory associated with the array, column sizes, and resets the number of rows to 0. -
printArrayStructure: This function returns a string that represents the structure of the array, including the number of rows and the number of columns in each row. -
printArray: This function returns a string that represents the array, with each row on a new line and values within rows separated by commas. -
addRow: This function adds a new row with 0 columns to the end of the array. -
addValueToRow: This function adds a value to the end of a specified row in the array. -
removeRow: This function removes a specified row from the array. -
removeValueFromRow: This function removes all occurrences of a specified value from a specified row in the array. -
rowSum: This function returns the sum of all values in a specified row in the array. -
rowAvg: This function returns the average of all values in a specified row in the array. -
rowMax: This function returns the maximum value in a specified row in the array. -
rowMin: This function returns the minimum value in a specified row in the array.
Each function has specific requirements and assumptions as detailed in the question.
Similar Questions
3.1.1 Functions• createArray(array: int**&, numColumns: int*&, numRows: int& , input: std::string): void– If no previous arrays have been created, the passed-in parameters will be NULL. If apreviously created array was already stored there, the parameters will be non NULL. Ifthe passed-in parameters are not NULL, you may assume they follow the specificationsstated at the start of this section.– The passed-in string should be used to populate the variables.– Rows are split using a bar, |.– If no bars are present, then it means only one row in the array.– The values in each row are split using commas. You may assume that the values betweencommas will always be valid integers.– A row can also be an empty string. In this case, that row should be an array that has asize of 0.– You may assume that the input string will always follow these specifications, and you donot need to check whether the input is valid.• destroyArray(array: int**&, numColumns: int*&, numRows: int&): void– This will deallocate all of the passed in variables.– After this function is called, array and numColumns should be NULL, and numRowsshould be 0.• printArrayStructure(array: int**&, numColumns: int*&, numRows: int&): std::string– This function returns a string representing the structure of the array.– The string starts with the word “numRows”, followed by a space, then a colon, and thenanother space.– The number of rows is then appended to this string, with a newline after this.– For every row, the following is then appended:∗ The word “row”, followed by the row number that starts from 0 inside square brackets.After the second square bracket, there is a space, followed by a colon, followed by aspace.∗ After this, the number of columns for that row is appended.∗ For all rows except the last row, a new line is added to the end. printArray(array: int**&, numColumns: int*&, numRows: int&): std::string– This function returns a string representing the array.– Each row should be printed on its own line. Each line should end with a new line, exceptthe last row.– The elements in each row should be separated with a comma.– If the row has 0 columns, then an empty string should be used as the row.• addRow(array: int**&, numColumns: int*&, numRows: int&): void– This function should add a row to the end of the array.– The new row should have 0 columns.• addValueToRow(array: int**&, numColumns: int*&, numRows: int&, rowNumber: int, value:int): void– This function will attempt to add the passed-in value, to the end of the row indicated bythe passed-in rowNumber.– If the rowNumber is invalid, then this function does nothing.• removeRow(array: int**&, numColumns: int*&, numRows: int&, rowNumber: int): void– This function will attempt to remove a row from the array, indicated by the passed-inrowNumber.– If the rowNumber is invalid, then this function does nothing.• removeValueFromRow(array: int**&, numColumns: int*&, numRows: int&, rowNumber: int,value: int): void– This function will attempt to remove values from a row in the array.– All occurrences of the passed-in value should be removed from the row indicated byrowNumber.– If the rowNumber is invalid, then this function does nothing.• rowSum(array: int**&, numColumns: int*&, numRows: int&, rowNumber: int); int– This function returns the sum of the passed-in rowNumber.– If the rowNumber is invalid, then return -1.• rowAvg(array: int**&, numColumns: int*&, numRows: int&, rowNumber: int): float– This function returns the average of the passed-in rowNumber.– If the rowNumber is invalid or if the number of columns for that row is 0, then return -1. rowMax(array: int**&, numColumns: int*&, numRows: int&, rowNumber: int): int– This function returns the maximum element of the passed-in rowNumber.– If the rowNumber is invalid or if the number of columns for that row is 0, then return -1.• rowMin(array: int**&, numColumns: int*&, numRows: int&, rowNumber: int): int– This function returns the minimum element of the passed-in rowNumber.– If the rowNumber is invalid or if the number of columns for that row is 0, then return -1.
How can you define an array in C/C++?
How can you define an array in C/C++?*1 pointA. array int[]B. int array{}C. int[] arrayD. int array[]
what is an array
How can you define an array in C/C++?*0/1A. array int[] B. int array{}C. int[] arrayD. int array[]
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.