Click here to Skip to main content
15,664,272 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
vector<vector<int>> transmult(int a,int b,int c)
The above is a function given in one of the exams I took and we were asked to do the following:
Take 3 values from the user:
1.FirstValue 2.Rows 3.Columns
Taking the first value create an increment matrix that is if first value is 2 and it is a 3*3 matrix than the contents of the matrix will be:
2 3 4
5 6 7
8 9 10
after this we have to find the transpose of the matrix and multiply the original matrix and the transpose matrix and return the result.
I can solve this program normally but wanted to know how to solve this using the above function in c++?

What I have tried:

I tried without function but it is not working it is working normally I am unable to understand how to use the function
Updated 2-Sep-18 6:14am
Richard MacCutchan 3-Sep-18 7:32am    
You use the function exactly the same way. Instead of taking input from the user, it is provided to the function in the three parameters.

We can't help you: we weren't in your exam, and have never seen this transmult function as a result.

Since we have no idea what it does, how it does it, or even what parameters you pass to it or expect to get back there is nothing we can do to help you. Instead, contact your tutor and explain your difficulty and ask him what you are doing wrong. He's probably got copies of the exam papers so that next year can practice with them.
Share this answer
I don't think you are asking the right question. What you asked was how do you use the function and here is how:
typedef std::vector<int>    vecint;
typedef std::vector<vecint> vecvecint;

int first=2;
int rows=3;
int cols=3;

vecvecint vvi = transmult( first, rows, cols );
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900