# Question & Answer: Write a function named "make_mult_table" that takes an integer (denoting the max_factor) and returns a vector of…..

Write a function named “make_mult_table” that takes an integer (denoting the max_factor) and returns a vector of vectors of longs representing a multiplication table from 0 to (and including) max_factor.

Example:

Don't use plagiarized sources. Get Your Custom Essay on
Question & Answer: Write a function named "make_mult_table" that takes an integer (denoting the max_factor) and returns a vector of…..
GET AN ESSAY WRITTEN FOR YOU FROM AS LOW AS \$13/PAGE

max_factor = 3

Return value:

```{ {0, 0, 0, 0},
{0, 1, 2, 3},
{0, 2, 4, 6},
{0, 3, 6, 9},  }
```

use c++

#include <iostream>

#include <cstdlib>
#include <vector>
using namespace std;

vector<vector < long > > make_mult_table(long max_factor){
vector<vector < long > > vec;
for(int i=0;i<=max_factor;++i){

vector<long>v;
for(int j=0;j<=max_factor;++j){
v.push_back(i*j);

}
vec.push_back(v);

}
return vec;
}
int main()
{
vector< vector < long > > vec = make_mult_table(3);

for (int i = 0; i < vec.size(); i++)
{
cout<<endl;
for (int j = 0; j < vec[i].size(); j++)
{
cout << vec[i][j] <<” “;
}
}
return 0;
}
=====================================================
See Output