Question: Just functions.cpp plz There is no set output. Just turn in the functions.cpp Lab 2: Functions For this lab, you will use the two functions





Just functions.cpp plz
There is no set output. Just turn in the functions.cpp
Lab 2: Functions For this lab, you will use the two functions f(x) = 3.r* +5 and g(t) = 7x+10. You will write two functions for f and two functions for g that will determine if each function is one-to-one or onto on the given domain. Functions You should implement the following functions: fOneToOne:Takes an array of doubles and the length of the array. It returns true if f, as defined above, is one-to-one on that particular domain. fOnto:Takes two arrays of doubles and the length of each array. The first array is the domain; the second array is the target. It returns true if f, as defined above, is onto on that particular domain and target. gOneToOne:Takes an array of doubles and the length of the array. It returns true if g, as defined above, is one-to-one on that particular domain. gonto:Takes two arrays of doubles and the length of each array. The first array is the domain; the second array is the target. It returns true if g, as defined above, is onto on that particular domain and target. The function declarations are given in functions.h. Do not modify the function signa- tures. Do not add other functions. I've also given you a main function that contains a sample test. Be sure to test your functions thoroughly. Hints . You'll probably want to store the output of the function and then check that the output matches the desired property. You can use an array or a vector to store the output. You can assume the parameters won't have any more than 20 elements. You can use the pow function from the math header The const array just means you can't modify that array. You don't have to implement anything specific in main. You won't turn in that file. Use it to test your functions. What to Turn In Upload functions.cpp. You don't need to turn in functions.h, as you should not have modified it. functions.cpp functions.h main.cpp 1 #ifndef FUNCTIONS_H 2 #define FUNCTIONS_H 3 4 // Returns true if f(x) = 3*x^4 + 5 5 // is one to one on the domain given in the array 6 // with length len 7 // Note you don't actually need the target to determine 8 // if f is one-to-one. 9 // Returns false otherwise 10 bool foneToOne(const double domain[], int len); 11 12 // Returns true if f(x) = 3*x^4 + 5 13 // is onto on the domain given in the array 14 // with length xSize. The target is given in 15 // target with length ySize. 16 // Returns false otherwise 17 bool fonto(const double domain[], int xSize, const double target[], int ySize); 18 19 20 // Returns true if g(x) = 7x + 10 21 // is one to one on the domain given in the array 22 // with length len 23 // Note you don't actually need the target to determine 24 // if f is one-to-one. 25 // Returns false otherwise 26 bool gOneToOne(const double domain[], int len); 27 28 // Returns true if g(x) = 7x + 10 29 // is onto on the domain given in the array 30 // with length xSize. The target is given in 31 // target with length ySize 32 // Returns false otherwise 33 bool gonto(const double domain[], int xSize, const double target[], int ySize); 34 35 36 37 #endif 38 main.cpp functions.cpp functions.h 1 \include "functions.h" 2 3 #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
