39、求中间数的四种方法

#include
#include
#include 
using namespace std;
int main2(){
    int  a,b,c;
    freopen("min.in","rb",stdin);
    freopen("mid.out","wb",stdout);
    cin>>a>>b>>c;
    cout<b){
        if(a>c){
           if(b>c) cout<c){
           if(a>c)  cout<temp[0]){
           int t=temp[0];
           temp[0]=temp[2];
           temp[2]=t;                   
        }
        if(temp[1]>temp[2]) fprintf(out,"%d",temp[1]);
        else    fprintf(out,"%d",temp[2]);     
}
int main3(){
    int  a,b,c;
     ifstream  fin("mid.fin");
     ofstream  fout("mid.fout");
     fin>>a>>b>>c;
     if(a>b&&b>c) 
       fout<c&&c>b) 
       fout<c&&c>a) 
       fout<a&&a>c) 
       fout<b&&b>a) 
       fout<a&&a>b) 
       fout<='0'&&a[mark]<='9')){
      mark++;                                     
   }   
   while(a[mark]>='0'&&a[mark]<='9'){
      obj=obj*10+a[mark++]-'0';
   }
   return obj;
}
int main(){
    FILE *in =fopen("mid.fin","rb");
    
    FILE  *out=fopen("mid.fou","wb");
    int num = fread(a,4,50,in);// 1表示的是单个元素的大小  总共存储20个元素 
    
    int b,c,d;
    
    b=getNum();
    
    c=getNum();
       
    d=getNum();
    
    if((b-c)*(c-d)>=0)   fprintf(out,"%d",c);
    
    else  if((c-b)*(b-d)>=0)    fprintf(out,"%d",b);
    
    else    fprintf(out,"%d",d);
    
   
}

 

你可能感兴趣的:(算法)