fz2023 • 7个月前
using namespace std;
int main(){
double a,b,c,s; cin>>a>>b>>c; s=a+b+c; cout<<fixed<<setprecision(1)<<s<<endl; return 0;
}
评论:
cout<<fixed<<setprecision(1)<<s<<endl;错误,应改为cout<<s<<endl;他没说精度,所以保留所有位小数
cout<<fixed<<setprecision(1)<<s<<endl;
cout<<s<<endl;
你用了double就不用保留精度了