Capgemini interview question

code for matrix question in c++