L2期中测试-3
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
当C++代码中已包含头文件#include <iomanip>的情况下,下列哪一项可以正确输出变量pi = 3.1415926,并保留两位小数(输出结果为3.14)?
{{ select(1) }}
- cout << pi << endl;
- cout << fixed << setprecision(2) << pi << endl;
- cout << setprecision(2) << pi << endl;
- cout << fixed << pi << endl;