使用std::swap();
#include<iostream>
//using namespace std;
int main(int argc, char *argv[])
{
int a = 5;
int b = 8;
std::swap(a, b);
std::cout<<a<<" "<<b<<std::endl;
return 0;
}
使用std::swap();
#include<iostream>
//using namespace std;
int main(int argc, char *argv[])
{
int a = 5;
int b = 8;
std::swap(a, b);
std::cout<<a<<" "<<b<<std::endl;
return 0;
}