重载

#include<iostream>
using namespace std;
int m(int x,int y,int z);
short m(short q,short w,short e);
double m(double a,double s,double d);  
int main(){
    int a,b,c,min;
    cin>>a>>b>>c;
    min=m(a,b,c);
    cout<<"the min is "<<min<<endl;

    short ac,bc,cc,minc;
    cin>>ac>>bc>>cc;
    minc=m(ac,bc,cc);
    cout<<"the min is "<<minc<<endl;
    
    double ad,bd,cd,mind;
    cin>>ad>>bd>>cd;
    mind=m(ad,bd,cd);
    cout<<"the min is "<<mind<<endl;
    return 0;
}
inline int m(int x,int y,int z){
       if(z<x)
       x=z;
       if(y<x)
       x=y;
       return x;
   }
   inline short m(short x,short y,short z){
       if(z<x)
       x=z;
       if(y<x)
       x=y;
       return x;
   }
   inline double m(double x,double y,double z){
       if(z<x)
       x=z;
       if(y<x)
       x=y;
       return x;
   }

 

 

 

posted on 2017-11-09 20:41  三叶癌  阅读(110)  评论(0编辑  收藏  举报

导航