C++学习(三):交换2个数

#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
    int i;
    cin >> i;
    int j;
    cin >> j;

    i = i + j;
    j = i - j;
    i = i - j;

    cout << i << endl; 
    cout << j << endl;
    system("pause");
    return 0;
}

 

posted @ 2019-10-29 17:50  liw66  阅读(199)  评论(0编辑  收藏  举报