// Lab Test #1 Version #1 #include "stdstuff.h" // Write the two functions indicated. It is not necessary to write any // function prototypes. Just write the complete functions at the top // of the file as indicated. // Your functions must work for *any* input, not just for the examples // given in this main program. You are welcome to add additional test // cases. // Note that program comments are required for full marks. // This function (numberFacts) has three parameters and returns nothing (void). // The first parameter is an integer. // The second parameter is "return"ed by the function. // It is set to true if the first parameter is less than 0, and false otherwise. // The third parameter is "return"ed by the function. // It is set to true if the first parameter is an exact multiple of 4 // (e.g. -4, 0, 4, 8, ...), and false otherwise. void numberFacts( int x, bool &lessThanZero, bool &multFour ) { lessThanZero = (x<0); // true if x<0 and false otherwise multFour = (x%4==0); // true if x%4 is 0 and false otherwise // alternatively: // if (x<0) // lessThanZero = true; // else // lessThanZero = false; // if (x%4==0) // or x/4==x/4.0 // multFour = true; // else // multFour = false; } // This function (arrayInfo) has three parameters and returns an integer. // The first parameter is an integer indicating the length of the array. // The second parameter an integer. // The third parameter is an array of integers. // If the first parameter (length of the array) is invalid (i.e. doesn't // make sense), the function returns -1. // Otherwise, this function returns the number of elements of the array // that are within 10 of the the second parameter (i.e. the difference // between the array element and the second parameter is less than or // equal to 10). int arrayInfo(int n, int value, const int a[]){ // const optional int count = 0; // used to count the elements of the array within 10 of value if (n<1) // if array length is less than 1, we have a problem return -1; // indicate that the array length is invalid for (int i=0;i