
c++编译出现这个错误 求高手解决一下 : error C2668: 'Swap' : ambiguous call to overloaded function 10
#include"stdafx.h"#include<iostream>usingnamespacestd;voidSwap(inta,intb);voidSwap(in...
#include "stdafx.h"
#include<iostream>
using namespace std;
void Swap(int a, int b);
void Swap(int& a, int& b);
void main()
{
int x(5), y(10);
cout<<"x="<<x<<" y="<<y<<endl;
Swap(x,y);
cout<<"x="<<x<<" y="<<y<<endl;
}
void Swap(int& a, int& b)
{
int t;
t=a;
a=b;
b=t;
}
void Swap(int a, int b)
{
int t;
t=a;
a=b;
b=t;
} 展开
#include<iostream>
using namespace std;
void Swap(int a, int b);
void Swap(int& a, int& b);
void main()
{
int x(5), y(10);
cout<<"x="<<x<<" y="<<y<<endl;
Swap(x,y);
cout<<"x="<<x<<" y="<<y<<endl;
}
void Swap(int& a, int& b)
{
int t;
t=a;
a=b;
b=t;
}
void Swap(int a, int b)
{
int t;
t=a;
a=b;
b=t;
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询