Matrix to Stream
mediumQuestion 641Write a function void printMatrix(ostream& out, const vector<vector<int>>& m) that writes each row of the matrix on its own line, with every value right-aligned in a field 4 characters wide (padded with spaces on the left) and nothing else between values. Each line ends with a newline.
Do NOT write a main function.
Expected output
1 2 10 20 100 5 42 -3 0 7
= newline. The output ends with a newline, so print one after the last line.
Hints4 available
Sign in to use hintsTopics
Streamsostream
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)
Your output
Run your code to see the output here...
Test cases
Run your code to see test case results.