This is part of my code that calculates xi
using a class cosmology.xi_DM
.
I am very new to C++, so please bear with me!
double redshift = 0.75;
string method = "CAMB";
vector<double> r = {1., 2.};
double xi = 0.;
for (int i=0; i<r.size(); i++)
xi = cosmology.xi_DM(r[i], method, redshift);
cout << "xi_DM(z=" << redshift << ") = " << xi << endl;
However, when I print
it, I only get the value of xi
for r = 2.
. It does not print xi
for r = 1.
. Why is this so?