Home  >  Q&A  >  body text

How to solve the connection error encountered when compiling c++ with VC6.0?

How to solve the connection error encountered when compiling c++ with VC6.0?

#include<iostream.h>

int up(int m);
int down(int s);
void mian(){
    int a;
    int b=0;
    cin>>a;
    while(b!=6174){
    b=down(a)-up(a);
    cout<<down(a)<<"-"<<up(a)<<"="<<b<<endl;
    }
    
}
int up(int m){
    int a[4];
    a[3]=m%10;
    a[2]=(m%100-m%10)/10;
    a[1]=(m%1000-m%100)/10;
    a[0]=(m%10000-m%1000)/10;
    for(int k=1;k<4;k++)
        if(a[k]<a[k-1]){
            int j=k-1;
            int x=a[k];
            a[k]=a[k-1];
            while(x<a[j]){
                a[j+1]=a[j];
                j--;
            }
        }
        m=a[0]*1000+a[1]*100+a[2]*10+a[3];
        return m;
}
int down(int s){
    int a[4];
    a[3]=s%10;
    a[2]=(s%100-s%10)/10;
    a[1]=(s%1000-s%100)/10;
    a[0]=(s%10000-s%1000)/10;
    for(int k=1;k<4;k++)
        if(a[k]>a[k-1]){
            int j=k-1;
            int x=a[k];
            a[k]=a[k-1];
            while(x>a[j]){
                a[j+1]=a[j];
                j--;
            }
        s=a[0]*1000+a[1]*100+a[2]*10+a[3];
        return s;
    }

}

伊谢尔伦伊谢尔伦2686 days ago623

reply all(2)I'll reply

  • PHP中文网

    PHP中文网2017-05-16 13:32:13

    main function is not defined

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-16 13:32:13

    Your main function name is spelled wrong.

    reply
    0
  • Cancelreply