65,210
社区成员
发帖
与我相关
我的任务
分享
// d.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
using namespace std;
void Swap(int a,int b);
int _tmain(int argc, _TCHAR* argv[])
{
int x(5),y(10);
cout << "x="<<x<<" y="<<y<<endl;
swap(x,y);
cout << "x="<<x<<" y="<<y<<endl;
system("pause");
}
void Swap(int a,int b)
{
int t;
t = a;
a = b;
b = t;
}
#include "stdafx.h"
using namespace std;
void Swap(int a,int b);
int _tmain(int argc, _TCHAR* argv[])
{
int x(5),y(10);
cout << "x="<<x<<" y="<<y<<endl;
swap(x,y); ///////////////////////////////////你调用的是swap(),库中有这样的函数。
cout << "x="<<x<<" y="<<y<<endl;
system("pause");
}
void Swap(int a,int b)
{
int t;
t = a;
a = b;
b = t;
}