Write a program in c plus plus to read a 3X3 matrix and find smallest number in that matrix?

#include<iostream>

#include<array>

#include<climits>

#include<cassert>

#include<time.h>

// 3x3 matrix typedef

using Row = std::array<int, 3>;

using Matrix = std::array<Row, 3>;

int smallest (Matrix& matrix)

{

int small = INT_MAX;

for (size_t r=0; r<matrix.size(); ++r)

{

const Row& row = matrix[r];

for (size_t col=0; col<row.size(); ++col)

{

if (row[col]<small)

small=row[col];

}

}

return small;

}

int main()

{

srand((unsigned)time(nullptr));

std::cout << "Matrix:\n" << std::endl;

Matrix matrix;

for (size_t r=0; r<matrix.size(); ++r)

{

Row& row = matrix[r];

for (size_t col=0; col<row.size(); ++col)

{

row[col] = rand();

std::cout << row[col] << '\t';

}

std::cout << std::endl;

}

std::cout << std::endl;

std::cout << "Smallest value in matrix: " << smallest (matrix) << std::endl;

std::cout << std::endl;

}