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

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

最佳回答

着急的手套

高兴的发夹

2026-11-12 08:31:15

#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-11-12 08:31:15

    #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是什么意思