30
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).