/*三数取中间值*/
//
#i nclude <stdio.h>
#i nclude <stdlib.h>
#i nclude <string.h>
int getMid(int a,int b,int c)
{
int mid=0;
if ((a>b)&&(a<c))
mid=a;
else if ((b>a)&&(b<c))
mid=b;
else if(a==b)
mid=a;
else
mid=c;
return mid;
}
int main()
{
int x;
x=getMid(22,11,44);
x=getMid(22,33,44);
x=getMid(22,33,30);
x=getMid(22,22,44);
x=getMid(22,44,44);
x=getMid(22,55,22);
x=getMid(66,66,66);
return 0;
}
51FLY 2009.12.14
文章评论(0条评论)
登录后参与讨论