#include <stdio.h> int main() { int n = 0; float b, c, d; scanf("%d;%f,%f,%f",&n, &b, &c, &d); printf("The each subject score of No. %d is %.2f, %.2f, %.2f.",n, b, c, d); return 0; } 收获:学到了%f 是与 float 单精度浮点型匹配的;%lf是与double 双精度浮点型匹配的;不能相互混着用,不然会报错。还有就是%f 的保留2位小数为%.2f,记得加'.'。