帮我重新编写一个子函数swap及调用swap语句,完成交换X与Y的值,swap的形参采用地址变量的方式

学习 时间:2026-08-13 09:08:41 阅读:723
帮我重新编写一个子函数swap及调用swap语句,完成交换X与Y的值,swap的形参采用地址变量的方式

最佳回答

怕黑的钢笔

甜蜜的自行车

2026-08-13 09:08:41

#include#includeusing namespace std;int swap(int&a,int&b){ int temp; temp = a; a = b; b = temp; }int main(){int a,b;cin>>a>>b;swap(a,b);cout

最新回答共有2条回答

  • 尊敬的可乐
    回复
    2026-08-13 09:08:41

    #include#includeusing namespace std;int swap(int&a,int&b){ int temp; temp = a; a = b; b = temp; }int main(){int a,b;cin>>a>>b;swap(a,b);cout

上一篇 :You are so lucky,becauseyou can choose to love me or not,bu

下一篇 peter lillback是什么意思