This looks like your homework and I suspect you will have very little takers in doing your homework for you.
However, I will try and explain functions for you and hopefully you can apply this to doing your homework.
When you use functions you need to declare it, define it and then call it.
The way I usually do it is declare it, then define it and then call it where I need it.
When you declare a function it needs to have a type, a name and parameters (parameters can be nil)
here is an example:
int Area_of_Rectangle (int, int);
//here int is the type, Area_of_Rectangle is its name and it takes 2 integers as its parameters.
Basically in your declaration you are telling the computer that Area_of_Rectangle will take 2 integer values and return an integer value.
Now you need to define the function.
int Area_of_Rectangle (int length, int width)//the type, name and number and types of parameters must match the declaration
return (length * width);//here length is multiplied by width and the function returns that value
To call this function you would do this:
Area_of_Rectangle (length, width);
Hope this helps.