用C++编写程序求三个数中 中间大小的哪个数,该怎么做?请多提供几种方法!谢谢!
来源:百度知道 编辑:UC知道 时间:2024/06/22 20:40:08
#include <stdio.h>
int main (void)
{
int a,b,c,t;
scanf ("%d %d %d",&a,&b,&c);
if (a>b) {t=a; a=b; b=t;}
if (b>c) {t=b; b=c; c=t;}
printf ("%d",b);
}
这个程序就是先将读入的三个数排序,输出中间的数