比较三个数的大小的方法

比较三个数的大小的方法

int a,b,c;
if(a>c)
c=a;
if(b>c)
c=b;
cout<<c;
第二种方法,
d=max(b,max(a,c))

排序后面再写

 if(a>c)
   s=c; c=a;a=s
    if(b>c)
   d=c; c=b;b=d;
    cout<<c;
    if(s>d)
    cout........
    else
    cout<<.....
    还可以选择排序,冒泡排序

猜你喜欢

转载自blog.csdn.net/weixin_43822669/article/details/90547987