题解 | 学生基本信息输入输出

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include<math.h>
int main() {
    long  a;
    float b, c, d;
    scanf("%ld;%f,%f,%f", &a, &b, &c, &d);
    b=round(b*100)/100;
    c=round(c*100)/100;
    d=round(d*100)/100;
    printf("The each subject score of No. %ld is %.2f, %.2f, %.2f.", a, b, c, d);
    return 0;
}

直接用%.2f精度不行,遇到0.5进不了位

不知道为什么

之前的人都能过

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务