Transformation from Geocentric Coordinates into Equatorial Coordinates? I have the moon's position in equatorial coordinates (RA and Dec) and now I want to calculate same moon's position in terms of earth centered coordinates i.e. Geocentric (latitude &amp; longitude). My main goal is to establish a c++-code that gives me this transformation from RA,Dec to Lat,Lon and vice versa. 

EDIT: More precisely, I have moon’s position in equatorial geocentric coordinates with following details:

Origin: Center of Earth
Lat   : Declination With fundamental Plane: Celestial Equator
Lon   : R.A.        With Primary direction: Vernal Equinox

And I am able to obtain the moon’s position corresponding to a specific Modified Julian Date (MJD). I am also able to calculate moon’s position in xyz-coordinates by following calculations

$X= EarthMoon*sin(PI/2.-dec_moon*deg2rad)*cos(ra_moon*deg2rad);$
$Y= EarthMoon*sin(PI/2.-dec_moon*deg2rad)*sin(ra_moon*deg2rad);$
$Z= EarthMoon*cos(PI/2.-dec_moon*deg2rad);$

where EarthMoon is the distance between Earth and Moon. Further, I am converting them into Horizon Coordinates (topocentric) w.r.t to an observer at a specific location by using my subroutine and this part done.

Further, I am initiating my simulated CR-particles from observer site. E.g. vCR[3]= {R,lat,lon}

vCR[3]={Rearth+2300, 31.30, 55.74} //Geocentric CS (earth-based)

And converting them into Geocentric Cartesian coordinates(x,y,z). Finally, I have

vM[3]={X,Y,Z}; in Equatorial geocentric coordinate system
vCR[3]={x,y,z}; in Geocentric Coordinate System i.e. Earth based  

That is my particular question in which I want to make vM[moon position] and vCR[CR position] to lie in same coordinates to get my final result. i.e. transformation from Geocentric (R,lat,lon) into Equatorial Geocentric (h,R.A,Dec).
Note: For vCR[3]: zero-longitude is the Prime Meridian, Greenwich whereas for vM[3] it’s vernal equinox in celestial sphere there is the difference.
If I understand your question correctly than your problem is that the primary direction of vCR[3] is the intersection between the prime meridian and the Earth's equator, instead of the vernal equinox. The geographical latitude is the same as the declination, but to get the right ascension you will need to rotate your coordinates around the z-axis by an amount that is equal to the sidereal time at Greenwich ($\theta_G$). This is done, simply by replacing the the longitude (lon) with the sidereal time at your location $\theta = \theta_G-lon$.

x =  R* cos(lat) * cos(theta);
y=   R* cos(lat) * sin(theta);
z =  R* sin(lat);

vCR[3]={x,y,z};


where theta is the sidereal time $\theta$. 

The sidereal time is not a time but actually an angle that gives the right ascension of objects that are at that moment crossing the local meridian (i.e. the line between South and the Celestial north pole, for observers on the northern hemisphere). It is in a sense the longitude of your position on Earth if the geographical coordinate system were to rotate along with the celestial sphere.

EDIT: To calculate the Sidereal time, you can use the method explained in Astronomical Algorithms by Jean Meeus:

$$T = \frac{JD-2451545.0}{3625}$$
$$\theta_0 = 100.46061837 + 36000.770053608 T + 0.000387933 T^2 - \frac{T^3}{38710000}$$

The sidereal time is expressed in degrees.

Then express the UTC time as an angle: 

$$t = 15h+0.25m+\frac{0.25}{60}s$$

where $h$ is the number of hours, $m$, the number of minutes, and $s$ the number of seconds.

The sidereal time at Greenwich at the specified time is then:

$$\theta_G = \theta + 1.00273790935*t $$

and the local sidereal time is:

$$\theta = \theta_G - L$$

Where $L$ is the geographical longitude (positive west from Greenwich).