You get mixed C and C ++.
printf is a function from the c library that prints a formatted string to standard output. ofstream and its operator << is how you print a file in C ++ style.
Here you have two options, you can print it in the C or C ++ way.
Style C:
FILE* vout = fopen("potential.txt", "w"); fprintf(vout, "%.3f %.5f\n",Rf*BohrToA,eval(0)*hatocm);
C ++ style:
#include <iomanip> //... ofstream vout("potential.txt"); vout << fixed << setprecision(3) << (Rf*BohrToA) << " "; vout << setprecision(5) << (eval(0)*hatocm) << endl;
source share