A problem about matrix

Hi! I have a homework to do but I can't solve one thing. Homework is about matrix. We ask to user a matrix. Then we should scan the matrix by 3x3 matrix an summary it. I did asking and taking the matrix but I couldn't do that scan thing I hope I can get help. Thank you!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <iostream>

int main(){
	int m[3][3] = {
		{0,1,2},
		{3,4,5},
		{6,7,8},
	};

	for(int K=0; K<3; ++K){
		for(int L=0; L<3; ++L)
			std::cout << m[K][L] << ' ';
		std::cout << '\n';
	}

	std::cout << "-----\n";

	for(auto &row: m){
		for(auto &value: row)
			std::cout << value << ' ';
		std::cout << '\n';
	}
}
Last edited on
Topic archived. No new replies allowed.