为什么在C中使用浮点转换说明符时没有输出

问题描述

我在下面为实验分配了代码,但是输出不是我期望的。没有错误,但是没有显示格式化的浮点数。有人可以解释我在做什么错吗?

任何帮助将不胜感激。

我的代码

    /*Include files */
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>     

int main(void){    

    char patients[] = {'A','C','D','E','F','G'};
    float edvValues[] = {118.0,120.0,119.0,122.0,124.0,121.0}; // Units of mL
    float esvValues[] = {48.0,55.0,52.0,53.0,50.0,51.0}; // Units of mL
    float heartRateValues[] = {62.0,80.0,65.0,70.0,66.0,64.0};
    
    for(int j = 0; j < sizeof(patients); j++){
            printf("Patient %c: ",patients[j]);
            printf("SV %d",(int)(edvValues[j] - esvValues[j]));
            printf(" CO %f L/min\n\r",(edvValues[j] - esvValues[j]) * heartRateValues[j]);
        }
    while(1);
}

这是预期的输出

correct output

这是我的输出

partially completed code that leaves out the area where the formatted float number should be

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)