Convert a c++ e power x program to cuda

Hi, the c++ code calculates e^x, how do you start converting it to cuda?

// emachtx.cpp : Defines the entry point for the console application.

//

#include "stdafx.h"

#include <cmath>

#include <string>

#include <iostream>

using namespace std;

double Abs(double Nbr)

{

if( Nbr >= 0 )

return Nbr;

else

return -Nbr;

}

int main ()

{

string again;

do{

//vars

double term = 1, som = 1;

int fac = 1, n = 1;

int x;

double Number = -88;

double Nbr = Abs(Number);

cout << "The absolute value of " << Number << " is " << Nbr << endl;

//IO

cout << "Geef x in:\n";

cin >> x;

cout << "X bedraagt: " << x << "\n";

//emachtx berkenen

while (term >= 0.000001) {

term = pow((double)x,n) / fac;

//ONEINDIGE LUS!!

term = Abs(term);

n++;

fac *= n;

int absfac = Abs(fac);

cout << absfac;

som += term;

cout << "(" << (n-1) << "): term : " << term << " - som : " << som << "\n";

}

cout << "Aantal keer door de lus : " << n << "\n";

cout << "\nNog eens ? ";

cin >> again;

cout << "\n";

} while (again == "y");

}