问题,如何交换两个变量的值

#include <iostream>
using namespace std;

int main()
{
    int a,b,temp;
    a = 10;
    b = 20;
    cout << "交换前a=" << a << ",b=" << b << "。" << endl;//输出交换前
    temp = a;
    a = b;
    b = temp;
    cout << "交换后a=" << a << ",b=" << b << "。" << endl;//输出交换前
    return 0; 
}