UMBC CMSC 201 Fall '05 CSEE | 201 | 201 F'05 | lectures | news | help |
/***************************************** ** Function: Square() ** This function squares a number of type double and returns it. ** ** Inputs: a value to be squared ** Outputs: returns the square of the number provided ****************************************/ double Square (double n) { return (n * n); } /************************************************** ** Function: FindMinimum () ** This function finds the minimum of two integers ** and returns the smaller of the two values. ** ** Inputs: integers n1 and n2 to be compared ** Outputs: returns the smaller of n1 and n2. ** returns n2 if values are equal **************************************************/ int FindMinimum (int n1, int n2) { int min; if (n1 < n2) { min = n1; } else { min = n2; } return min; }
return-type Name (p1, p2, ... pn) { statements }