C QUESTIONS 1 3 points Pick any three functions from each of
C++ QUESTIONS!!!
1) [3 points] Pick any three functions from each of the following C++ libraries and list their function signatures. If a function is overloaded, pick one of its versions:
a) cmath
Name
Signature
b) cstring
Name
Signature
c) cstdlib
Name
Signature
| Name | Signature |
Solution
a. cmath:
abs(): takes a double value as input and returns its absolute value as output.
pow(): takes 2 double values as input, and returns the first parameter raised to the power of second and will return the result.
sqrt(): takes the double value as input, and will return the sqrt of it as output.
b. cstring:
strcpy(): takes two character pointers as input, and copies the second string value to the first string. The first parameter is also returned as output.
strcat(): takes two character pointers as input, and appends the second string value to the first string. The first parameter is also returned as output.
strcmp(): takes two character pointers as input, and will be compared. The difference is returned as output.
c. cstdlib:
atoi(): takes a character pointer as input, returns the integer equivalent of the same string as output.
rand(): will generate a random integer in the range 0 and RAND_MAX and will be returned as output.
malloc(): takes the size as input, and will allocate size number of bytes from memory, and the pointer to the memory location will be returned as output.
![C++ QUESTIONS!!! 1) [3 points] Pick any three functions from each of the following C++ libraries and list their function signatures. If a function is overloaded C++ QUESTIONS!!! 1) [3 points] Pick any three functions from each of the following C++ libraries and list their function signatures. If a function is overloaded](/WebImages/6/c-questions-1-3-points-pick-any-three-functions-from-each-of-988359-1761507954-0.webp)