If you simply want to determine a certain power of a certain number, you can use the pow function(remember to include <math.h> )
1 2 3 4 5 6 7 8 9 10 11
#include <math.h>
#include <iostream>
usingnamespace std;
int main()
{
double a, b;
a = 5; // In your case a would be the radius
b = 2; // b would be the power.
cout<<"5 ^ 2 = " pow(a, b);
}
In general terms, the more modern ones such as cmath, cstring and all the rest tend to take advantage of C++, whereas math.h, string.h and so on are in straight C. The C++ versions use namespaces, which helps to keep things tidy. I have a feeling that in C++ the *.h set is deprecated, so there's the danger that one day they'll vanish and everyone's code will stop compiling :)
In this particular case, cmath contains extra functions for pow. The original C pow function only accepted double type, whereas the shiny new C++ version likes float and int in various combinations too. See also sqrt and probably lots of others.