Question: Write a function parseMatrix that takes 4 parameters - a string array strArray , its size, an int 2-D array matrix , max rows in
Write a function parseMatrix that takes 4 parameters - a string array strArray, its size, an int 2-D array matrix, max rows in 2D array. In string array strArray, each element consist of three numbers separated by a hyphen/dash (-) e.g. "0-1-2". The function should parse each element from strArray and store them as single integers in the matrix at same row index.
parseMatrix(string strArray[], int size, int matrix[][3], int n_rows)
For example: for strArray = ["1-2-3", "11-12-0"]
the final values in matrix:
| 1 | 2 | 3 |
| 11 | 12 | 0 |
use c++

Write a function parseMatrix that takes 4 parameters - a string array strArray, its size, an int 2-D array matrix, max rows in 2D array. In string array strArray, each element consist of three numbers separated by a hyphen/dash (-) e.g. "0-1-2". The function should parse each element from strArray and store them as single integers in the matrix at same row index. parseMatrix(string strArray, int size, int matrix[3], int n-rows) For example: for strArray = [" 1-2-3", " 11-12-01 the final values in matrix: 2 3 11 12 0 Answer: (penalty regime: 0 %) 1 void parseMatrix (string str, int size, int matrix[][3], int rows)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
