I'm trying to make a double Variance()
function with the return value rounded to 4th decimal point.
For example, if the result is 5.2992124
then it returns 5.2992
, and returns 8.9914
if the result is 8.991382
.
I know that there's cout << setprecision(~)
, printf("%.4d, ~")
, but I'm not sure how to utilize that in my case.
Thanks in advance.