VC如何用引用交换两数字?
#include<iostream.h>classjiaohuan{public:ab(int&a,&b);};jiaohuan::ab(int&a,int&b){int...
#include <iostream.h>
class jiaohuan
{public:
ab(int &a,&b);
};
jiaohuan::ab(int &a,int &b)
{int c;
a=c;
a=b;
b=c;
cout<<a<<endl<<b;
}
void main()
{jiaohuan huan;
huan.ab (3,5);
} 为什么我的不行 ?要怎么做? 展开
class jiaohuan
{public:
ab(int &a,&b);
};
jiaohuan::ab(int &a,int &b)
{int c;
a=c;
a=b;
b=c;
cout<<a<<endl<<b;
}
void main()
{jiaohuan huan;
huan.ab (3,5);
} 为什么我的不行 ?要怎么做? 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询