printf("use cesius,and enter q to quit.\n");
scanf("%f",& temperture);
为什么输入 q 就结束了
求解
#include <stdio.h>
int main()
{
const int freezing=0;
float temperture;
int cold_days =0;
int all_days = 0;
printf("enter the list of daily low temperture.\n");
printf("use cesius,and enter q to quit.\n");
while(scanf("%f",& temperture)==1)
{
all_days++;
if(temperture<freezing)
cold_days++;
}
if(all_days!=0)
printf("%d days total: %.f%% were below freezing.\n",
all_days,100.0*(float)cold_days/all_days);
if(all_days == 0)
printf("NO data entered\n");
}
守候你守候我
慕运维8079593