When do we include cmath and when do we include math.h? Do they mean the same thing? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 1

When do we include cmath and when do we include math.h? Do they mean the same thing?

was trying to learn how to use pow function...

24th Nov 2017, 5:11 AM
Just A Learner
Just A Learner - avatar
4 Respostas
+ 2
thanksšŸ‘
24th Nov 2017, 5:34 AM
Just A Learner
Just A Learner - avatar
+ 1
cmath is C++ way of including those functions like power ,squareroot,floor ect. while math.h is the older way from the C language. so basically they are the same
24th Nov 2017, 5:28 AM
Mind To Machine šŸ’»šŸ•†
Mind To Machine šŸ’»šŸ•† - avatar
+ 1
so if math.h is an older version why do we still use it in c++..? does it have something to do with lesser compilation time or something... you know.. cuz it's got lesser functions that we could include in our program so it probably would take less time for the computer to go through all the functions and picking the function that we need?šŸ¤”..(just asking)
24th Nov 2017, 5:55 AM
Just A Learner
Just A Learner - avatar
+ 1
cmath and math.h should give you access to the same functions. math.h works in cĀ±+ also so that c++ compilers will more compatible with c code.
24th Nov 2017, 9:46 AM
Jared Bird
Jared Bird - avatar