成绩输出,要求保留两位小数并且四舍五入,单输出的第一个成绩并没有四舍五入,而第二第三个成绩进行了四舍五入,不理解
#include <stdio.h>
int main()
{
int a =0;
double b =0;
double c =0;
double d =0;
scanf("%d;%lf,%lf,%lf",&a,&b,&c,&d);
printf("The each subject score of No. %d is %.2lf, %.2lf, %.2lf.",a,b,c,d);
return 0;
}
输入100;80.845,90.557,100.233
输出 The each subject score of No. 100 is 80.84, 90.56, 100.23.
我想要达到的结果
The each subject score of No. 100 is 80.85, 90.56, 100.23.
另外为什么相同的的代码在VS2019上跑出来的结果更加离谱
输入100;80.845,90.557,100.233
输出The each subject score of No. 100 is 80.84, 0.00, 0.00.