【c++】単純な3つの数の最大差

818 ワード

/*  
 * Copyright (c) 2014,            
 * All rights reserved.  
 *     :test.cpp  
 *       :     
 *     :2014  10   5   
 *      :v1.0  
 *  
 *     :           。
 *     :    。 
 *     :    ,      。 
 */   
#include <iostream>    
using namespace std;  
int main( )  
{  
    int a,b,c,max,min,m;  
    cout << "       : ";  
    cin >> a >> b >> c;  
    if(a>b) max=a,min=b;
       else max=b,min=a;
    if(c>max) max=c;
       else max=max;
    if(c<min) min=c;
       else min=min;
    m=max-min;
    cout<<"           :" << m <<endl;  
    return 0;  
}