题解 | #学生基本信息输入输出#
学生基本信息输入输出
https://www.nowcoder.com/practice/58b6a69b4bf943b49d2cd3c15770b9fd
#include <stdio.h> #include <math.h> int main() { typedef struct { int XH ; float C ; float M ; float E ; } A ; A i; scanf("%d;%f,%f,%f",&i.XH, &i.C, &i.M, &i.E); printf("The each subject score of No. %d is %.2f, %.2f, %.2f.\n", i.XH, i.C, i.M, i.E); return 0; } //有时候用lf类型 会出现四舍五入后不对的情况 唉 换成用float直接就对了 为什么呢?