麻烦高手解读下面程序说明功能main(){float a,b,c,t;scanf(“%f, %f, %f”,&a,&b,&c);if(a>b){t=a;a=b;b=t;}if(a>c){t=a;a=c;c=t;}if(b>c){t=b;b=c;c=t;}printf(“%5.2f, %5.2f, %5.2f”,a,b,c);}

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/08 06:48:19

麻烦高手解读下面程序说明功能main(){float a,b,c,t;scanf(“%f, %f, %f”,&a,&b,&c);if(a>b){t=a;a=b;b=t;}if(a>c){t=a;a=c;c=t;}if(b>c){t=b;b=c;c=t;}printf(“%5.2f, %5.2f, %5.2f”,a,b,c);}
麻烦高手解读下面程序说明功能
main()
{float a,b,c,t;
scanf(“%f, %f, %f”,&a,&b,&c);
if(a>b)
{t=a;a=b;b=t;}
if(a>c)
{t=a;a=c;c=t;}
if(b>c)
{t=b;b=c;c=t;}
printf(“%5.2f, %5.2f, %5.2f”,a,b,c);
}

麻烦高手解读下面程序说明功能main(){float a,b,c,t;scanf(“%f, %f, %f”,&a,&b,&c);if(a>b){t=a;a=b;b=t;}if(a>c){t=a;a=c;c=t;}if(b>c){t=b;b=c;c=t;}printf(“%5.2f, %5.2f, %5.2f”,a,b,c);}
C程序
main() '主函数声明
{float a,b,c,t; '定义变量a,b,c,t为单精度实型
scanf(“%f,%f,%f”,&a,&b,&c); '从屏幕获取三个实型字符,分别放入a,b,c
if(a>b) '循环条件当a>b
{t=a;a=b;b=t;} 't作为中转变量,a,b互换
if(a>c) '当a>c
{t=a;a=c;c=t;} 'a,c互换
if(b>c) '当b>c
{t=b;b=c;c=t;} 'b,c互换
printf(“%5.2f,%5.2f,%5.2f”,a,b,c); '屏幕输出a,b,c所代表的数字,各保留五位有效数字,小数点后保留两位
}
程序的作用是把输入的三个数字从小到大进行排列,并进行近似