HOw to convert to Template

Hey guys i'm just wondering if someone could help me convert this to a template function...

Code:

`#include<iostream>`

#include<cmath>

using namespace std;

int main()

{

double answer1 = 1, answer2 = 1, exponent = 1;

/* prompt the user */

cout << "This program calculates subtracts 2pow(n) from 3pow(n).\n\n";

cout << "Please enter a number (n): ";

cin >> exponent;

cout << "\n";

answer1 = pow(3,exponent);

answer2 = pow(2,exponent);

cout<< answer1 - answer2 << endl;

return 0;

}