We’ve seen how functions can be used to segment a program into reusable sections.  We can also pass the value of variables into functions to enable the functions to do more sophisticated things.  Variables which are declared along with a function are called parameters.  Here are some examples:

void myFunction() A function declaration named myFunction that accepts not parameters.
void myFunction(int a) A function declaration named myFunction that accepts one parameter of type int, named 'a'.
void myFunction(string s, int a) A function declaration named myFunction that accepts 2 parameters, the first a string named 's', and the second an int named 'a'.

We can have as many function parameters as we like, including none at all.  Once we have more than 1, we separate them with a comma.  When we call a function, we must pass in the correct number of parameters each of the correct type, and in the correct order, otherwise the compiler will tell us we have made an error.  Here are some examples:

myFunction(); Calls a function named myFunction that doesn't require any parameters.
myFunction(7); Calls a function named myFunction, that requires one parameter of type int.
int num = 42;

myFunction("Hello", num);

Calls a function named myFunction, that requires one parameter of type string and another of type int.

The program given to you prints out a line of X's of the given width, using a function that accepts 1 parameter.  

Tasks: