int get power(int t,int a)
{
If (a==0)
Returns1;
Returns t * get power(t, a-1);
}
double get power(double t,int a)
{
If (a==0)
Returns1;
Returns t * get power(t, a-1);
You can use function templates to simplify it.
Template & lttypename T>
T get power(T T,int a)
{
If (a==0)
Returns1;
Returns t * get power(t, a-1);
}