When you use a computer, all that the computer can do is differentiate between 0's and 1's. It then translates that into usable information.
A function is like a mini-program. It is run by your program. What type of value the function gives back when it is done is specified before the name. Then, inside the parenthesis, the information that the function needs to know to run is called the parameters. Sometimes the function may need no info to run. Then, at the end of the function after the code, if the function returns something (not void), it will say return and then some value. Here is a basic function that multiplies to numbers and returns that value.
Code:
#include <iostream>
using namespace std;
int multiply(int a, int b);/*names don't have to be the same as the names inputted into the function*/
int main()
{ int num1, num2, product;
cout<<"Input the first integer to be multiplied";
cin>>num1;
cout<<"Input the second integer to be multiplied"
cin>>num2;
product=multiply(num1, num2);
cout<<"The product of "<<num1<<" and "<<num2
<<" is "<<product;
return 0;//main is a function too + returns an int
}
int multiply(int a, int b)
{return a*b;}