use ILATE LAW

if u=first fn(higher precedence) which here is of cos(x)

v=second fn IS e^(x)

now

I=COS(X)INTEGRATE(E^(X))-INTEGRATE(DIFF(COS(X)INTEGRATE(E^(X)))

I=COS(X)E^(X)+INTEGRATE(SIN(X)E^(X))

NOW APPLY INTEGRATION OF PARTS ONE MORE TIME

I=COS(X)E^(X)+E^(X)SIN(X)-I WHERE I=INTEGRATE(E^(X)COS(X)) [UNDERSTAND IN TERMS OF RECURSION]

SOLVING I U GET

I=E^(X)(COS(X)+SIN(X))/2+CONSTANT