Chapter 3.9 - More Mathematical Library Functions C++

Ace your homework & exams now with Quizwiz!

The area of a square is stored in a double variable named area. Write an expression whose value is length of one side of the square.

sqrt (area)

Write the necessary preprocessor directive to enable the use of functions like sqrt and sin.

#include <cmath>

Write the necessary preprocessor directive to enable the use of the rand function.

#include <cstdlib>

Write the necessary preprocessor directive to enable the use of the time function.

#include <ctime>

If a right triangle has sides of length A, B and C and if C is the largest, then it is called the "hypotenuse" and its length is the square root of the sum of the squares of the lengths of the shorter sides (A and B). Assume that variables a and b have been declared as doubles and that a and b contain the lengths of the shorter sides of a right triangle: write an expression for the length of the hypotenuse.

sqrt((pow(a, 2)) + (pow(b,2)))

The area of a square is stored in a double variable named area. Write an expression whose value is length of the diagonal of the square.

sqrt(pow((sqrt(area)), 2) + pow((sqrt(area)) , 2))

The length of a rectangle is stored in a double variable named length, the width in one named width. Write an expression whose value is the length of the diagonal of the rectangle.

sqrt(pow(length, 2) + pow(width, 2))


Related study sets

Microbiology [14]: Regulation of Bacterial Cellular Processes

View Set

Q Mental Health - Substance Abuse Quiz EXAM 2 Combine, Q Substance-Related Disorders Combine, Q Townsend: Unit 5 Combine, **QChapter 14: Substance Use and Addictive Disorders - has ques from test 5 - Combine, **Psych Unit 6 Quizes for Test #2** P, Q...

View Set

ISDS 4070 Midterm Quiz Review Questions

View Set

Listening InQuizitive 22: Piano Sonata in C-sharp Minor, Op. 27, No. 2 (Moonlight), I

View Set

Earth Science B - Earth's Energy Resources

View Set

AP classroom psych study guide module 16-21

View Set