Math Functions in C++
Function |
Description |
Example |
---|---|---|
min(x, y) | Returns the minimum value of x and y. | cout << min(10, 20); |
max(x, y) | Returns the maximum value of x and y. | cout << max(10, 20); |
sqrt(x) | Returns the square root of x. | cout << sqrt(25); |
ceil(x) | It rounds up the value x to its nearest integer. | double ceilX = ceil(3.14159); |
floor(x) | It rounds the value of x downwards to the nearest integer. | double floorX = floor(3.14159); |
pow(x,n) | It returns the value x raised to the power of y | double result = pow(3.0, 2.0); |
C++ Cheatsheet
This is a C++ programming cheat sheet. It is useful for beginners and intermediates looking to learn or revise the concepts of C++ programming. While learning a new language, it feels annoying to switch pages and find different websites for different concepts that are easily understandable. You can learn C++ concepts very easily using this cheat sheet.
C++ is a high-level programming language. It was developed in 1983 by Bjarne Stroustrup at Bell Labs. It is used for developing various applications.
Contact Us