I am taking a class in C++ and I noticed there are only a few math operators to use. I also noticed that C++ does not come with an exponential operator within its math library.
Why must one always write a function for this? Is there a reason for the makers of C++ to omit this operator?
You don't write a function for this (unless you're insane, of course). There's a perfectly good pow
function defined in the <cmath>
header.
Aside: if you try to use
^
as a power operator, as some people are wont to do, you'll be in for a nasty surprise. It's the exclusive-or (XOR) operator (see here).