新手求助:大家帮我看一下这段代码.谢了...
一直提示有一个错误.这个是什么意思,我的是中文的V6.0.4.obj : error LNK2005: _main already defined in 3.obj
5.obj : error LNK2005: _main already defined in 3.obj
5.obj : error LNK2005: "void __cdecl swap(int,int)" (?swap@@YAXHH@Z) already defined in 4.obj
Debug/3.exe : fatal error LNK1169: one or more multiply defined symbols found
执行 link.exe 时出错.
代码如下:
#include <iostream>
using namespace std;
void swap(int,int);
int main()
{
int a;
int b;
cout<<"请输入a的值:";
cin>>a;
cout<<endl;
cout<<"请输入b的值:";
cin>>b;
cout<<endl;
cout<<"调用swap函数之前a,b的值为:"<<a<<"\t"<<b;
swap(a,b);
cout<<"请输入a的值:";
cin>>a;
cout<<endl;
cout<<"请输入b的值:";
cin>>b;
cout<<endl;
cout<<"调用swap函数之后a,b的值为:"<<a<<"\t"<<b;
return 0;
}
void swap(int x,int y)
{
int z;
z=x;
x=y;
y=z;
}