请教高手一下,下面的代码
#include<stdio.h>const int S_PER_M=60;
const int S_PER_H=3600;
const double M_PER_K=0.62137;
int main(void)
{
double distk,distm;
double rate;
int min,sec;
int time;
double mtime;
int mmin,msec;
printf("This progame converts yur time for a metric race\n");
printf("to a time for running a mile and to your average\n");
printf("speed in miles per hour.\n");
printf("Please enter,inkilometers,the distance run.\n");
scanf("%1f",&distk);
printf("Next enter the time in minutes and seconds.\n");
printf("Begin by entering the minutes.\n");
scanf("%d",&min);
printf("Now enter the seconds.\n");
scanf("%d",&sec);
time=S_PER_M*min+sec;
distm=S_PER_M*distk;
rate=distm/time*S_PER_H;
mtime=(double)time/distm;
mmin=(int)mtime/S_PER_M;
msec=(int)mtime%S_PER_M;
printf("You ran %1.2f km (%1.2f miles) in %d min,%d sec.\n",
distk,distm,min,sec);
printf("That pace corresponds to running a mile in %d min.",
mmin);
printf("%d sec.\nYou average speed was %1.2f mph.\n",msec,rate);
return 0;
}
上面的代码为什么输入一个数distk后,再按回车键就直接输出完了,不明白,不是还应该继续输入分钟和秒钟吗,谢谢