This sounds suspiciously like homework. Not going to give you an answer because homework is supposed to help you learn. I will point you to the
<cmath> (math.h)[
^] library because it has many of the functions you need. Figuring out how to use it is up to you though :)