#include<iomanip>
void student::show()
{
using namespace std;
cout.setf(ios::fixed);
cout.precision(2);
cout<<"ID:"<<ID<<endl
<<"name:"<<name<<endl;
}
要包含头文件:#include<iomanip>
补零:cout.setf(ios::fixed);
设置精度:cout.precision(2);