Here you go, a function that takes two parameters and calculates the sum.
Now if you dont want to display the result, instead you can calculate two numbers and give the sum as value for a third integer. You can do this in two ways:
The first 1, using return

This might look strange but the function will be handled as an ordinary integer, you can use it to assign it to an integer or you can display it directly:

cout<<calculate(10,20)

Now, the second way is using referances:

#include <iostream>
using namespace std;
void calculate(int a,int b,int& c); //you need to give the parameters after the name of your function
int main(){
int sum;
calculate(10,20,sum);
cout<<sum;//the integers' value is now 30
return 0;
}
void calculate(int a,int b,int& c) //the last parameter is a reference to an int, this will hold the sum of the 2 first integers
{
c=a+b;
}

Let me explain this: if you give a parameter to a function it will make a copy of it, so it wont change the values, by giving it a reference, it will change the value of the refered integer.
Sometimes this will be useful and sometimes it wont.