小数点以下3桁(固定)で出力せよ (fixed)

こう書く。

long double answer; 
// 答えを求める

// 出力
cout << fixed << setprecision(3);
cout << answer << endl;

おまけ(具体例)