Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

math functions c++

#include <cmath>//this is a library that gives us access to some math functions in c++

cout << pow(2,3);//power with base and power
cout << sqrt(123);//for square root
cout << round(2.34);//round number to the nearest value
cout << ceil(4.1);//always round upword
cout << floor(4.9);//round down
cout << fmax(3,10);//return the larger number
 
PREVIOUS NEXT
Tagged: #math #functions
ADD COMMENT
Topic
Name
9+2 =