题解 | #编写函数实现两数交换(引用方式)#

编写函数实现两数交换(引用方式)

https://www.nowcoder.com/practice/19ff3da82df740a9a662aaf59aa41c5d

#include <iostream>
using namespace std;

// write your code here......
void swap(int& m, int& n) {
    int temp;
    temp = m;
    m = n;
    n = temp;
}

int main() {

    int m, n;
    cin >> m;
    cin >> n;

    // write your code here......
    swap(m, n);

    cout << m << " " << n << endl;

    return 0;
}

全部评论

相关推荐

10-16 23:37
已编辑
门头沟学院 运营
据说名字越长别人越关...:西交做运营吗。。就业市场已经颠了
简历被挂麻了,求建议
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务