Explanation of Solution
cos():
The C++ library function, “cos()” returns the cosine of an argument.
- To use the “cos()” function, the “cmath” header file is required
- The “cos()” function is useful in some of the scientific and other special-purpose programs.
- The argument and the return type of the “cos()” is double.
Example:
b = cos(a);
Explanation:
“b” is a variable which contains the result of a cosine of the argument where “a” is a argument.
log():
Log is an “inverse operation” to exponentiation.
- To use the “log()” function, the “cmath” header file is required.
- Log returns the “natural logarithm” of argument.
- The argument and the return type of the “log()” is double.
Example:
b = log(a);
Explanation:
“b” is a variable which contains the result of a natural logarithm of the argument where “a” is a argument.
sin():
The C++ library function, “sin()” returns the sine of an angle.
- To use the “sin()” function, the “cmath” header file is required.
- The “sin()” function is useful in some of the scientific and other special-purpose programs.
- The argument and the return type of the “sin()” is double.
Example:
b = sin(a);
Explanation:
“b” is a variable which contains the result of a sine of the argument where “a” is a argument.
exp():
The C++ library function, “exp()” returns exponential function of an argument.
- To use the “exp()” function, the “cmath” header file is required.
- The “exp()” function is useful in some of the scientific and other special-purpose programs.
- The argument and the return type of the “exp()” is double.
Example:
b = exp(a);
Explanation:
“b” is a variable which contains the result of an exponent of the argument where “a” is an argument.
log10():
Log is an “inverse operation” to exponentiation.
- To use the “log10()” function, the “cmath” header file is required.
- Log10 returns the “base -10 logarithm” of argument.
- The argument and the return type of the “log10()” is double.
Example:
b = log10(a);
Explanation:
“b” is a variable which contains the result of a base-10 logarithm of the argument where “a” is a argument...
Want to see the full answer?
Check out a sample textbook solutionChapter 3 Solutions
EBK STARTING OUT WITH C++ FROM CONTROL
- For each of the following functions, indicate how much the function’s value will change it its argument is increased Triple. 3Narrow_forwardWhich statement below is true about a function: may have no parameters must always have a return statement must have at least one parameter its arguments always appear within bracketsarrow_forwardWrite a function that computes the average of the digits in an integer. Use the following function header: double averageDigits(long n)arrow_forward
- Write a function that checks whether an integer is an even digit or an odd digit integer using the following header: int getType(int n)arrow_forward. The electric company charges according to the following rate schedule: 9 cents per kilowatt-hour (kwh) for the first 300 kwh 8 cents per kwh for the next 300 kwh (up to 600 kwh) 6 cents per kwh for the next 400 kwh (up to 1,000 kwh) 5 cents per kwh for all electricity used over 1,000 kwh Write a function to compute the total charge for each customer. Write a main function to call the charge calculation function using the following data: Customer Number Kilowatt-hours Used 123 725 205 115 464 600 596 327 … … The program should print a three column chart listing the customer number, the kilowatt hours used, and the charge for each customer. The program should also compute and print the number of customers, the total kilowatt hours used, and the total charges.arrow_forwardThe area of an arbitrary triangle can be computed using the formulaarea = √(s(s–a)(s–b)(s–c))where the square root is applied to the entire product and where a, b, and c are the lengths of the sides, and s is thesemiperimeter of the triangle given by the formula:s = (a + b + c)/2 Write a void function named triangle that computes the area and perimeter (as well as the semiperimeter (which will be used to compute the area)of a triangle based on the length of the sides. The function should use five parameters and may call other functions.Make your function robust. Note that not all combinations of a, b, and c produce a triangle. Your function should produce correct resultsfor legal data and reasonable results for illegal combinations. Include in your submission a driver that repeatedly reads in 3 positive numbers thatare the sides of a triangle, and each time print out the sides and the area and perimeter calculated by the triangle function. Your program shouldterminate when the…arrow_forward
- Write a function to determine the cost of an automobile insurance premium, based on driver's age and the number of accidents that the driver has had. The basic insurance charge is $500. There is a surcharge of $100 if the driver is under 25 and an additional surcharge for accidents: \# of accidents Accident Surcharge 1 50 2 125 3 225 4 375 5 575 6 or more 700 Then call the function to print the result. example (underline denotes input values): ```Age? 26``` ```Accidents? 3``` ```$725```arrow_forward# Write a function called ex3(n) which# 1. accepts as an input parameter an integer between 1 and 100# 2. Calculates and print the mersenne primes between 1 and this number# See en.wikipedia.org/wiki/Mersenne_prime for details# 3. Invoke ex3(16) to print resultsarrow_forward# TODO: write the function signature for the following function header: """ multiply_accumulate(a, x, b) returns a * x + b TODO: replace this TODO with examples of multiply_accumulate() :param a: coefficient a above :param x: some float number :param b: coefficient b above :returns: result of the operations above """ left_operand = a * x result = left_operand + b return resultarrow_forward
- Create a function that takes an integer and returns Trueif it's divisible by 100, otherwise return False. Example: divisible(500) → True divisible(8) → False WRITE IN PYTHON PLEASEarrow_forwardWrite a function that returns the average of the digits in the even places in an integer using the following header: double avgOfEvenPlaces(int n)arrow_forwardThe following formula can be used to determine the distance an object falls due togravity in a specific time period:d =112 gt2The variables in the formula are as follows:• d is the distance in meters,• g is 9.8,• and tis the time in seconds that the object has been falling.Write a function named fall i ngDi stance that accepts an object's falling time (in seconds)as an argument. The function should return the distance, in meters, that the object hasfallen during that time interval. Write a program that demonstrates the function by callingit in a loop that passes the values 1 through 10 as arguments and displays the return value.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education