The purpose of practice problems is to learn the skills you need to succeed. Having someone else do the work and explain robs you of the benefit and satisfaction of completing it yourself.
That said, a function is essentially a named piece of code. Consider the basic hello world code
1 2 3 4 5 6
|
#include <iostream>
int main()
{
std::cout << "Hello World" << std::endl;
return 0;
}
|
We can create a function to do the same thing. as the following code.
1 2 3 4 5 6 7 8 9 10 11
|
#include <iostream>
void sayHello()
{
std::cout << "Hello World" << std::endl;
}
int main()
{
sayHello();
return 0;
}
|
Typically functions are used to represent operations that will be used multiple times. They increase the maintainability and the understanding of code.
For the problem you have, you have the function signature
void multiplyTable(int num)
This means that you do not return anything and you take an integer value as a parameter.
With the integer value you receive you need to generate the structure shown by your examples. The generic pattern can be described as
x *1 x*2 x*3 ... X*num
(x+1) (x+1)*2 (x+1)*3 ... (x+1)*num
.
.
.
num*1 num*2 num*3 .... num*num
I suggest thinking about what control structures and variables will be needed coming up with some code and then posting problems that come up as you implement. The purpose here is to aid others, not to inhibit their ability to become programmers by solving their problems for them.
Good luck