Matrices and Templates

Good evening!
I have some troubles with C++, but I need to complete the task.
______________________________________________________________________________
With the use of templates write a computer program in C++ programming language that:
* takes two double-matrices, performs their summation and puts it onto console;
* takes two fraction-matrices, performs their multiplication and puts it onto console.
_______________________________________________________________________________
Every help will be useful. Also I will be glad if someone explains me the "template part" of the code. I know what templates do, but I have no idea how to implement this.
You need to write Matrix as a template so that it can take doubles or fractions. I assume you've already written the fraction class.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
template<typename T>
class Matrix
{
    std::vector<T> v;
    size_t rows, cols;
public:
    Matrix(size_t r, size_t c)
        : rows{r}, cols{c} { v.resize(rows * cols); }
}

int main()
{
    Matrix<double> md;
    Matrix<Fraction> mf;
}

Topic archived. No new replies allowed.