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

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

最佳回答

雪白的故事

坚强的铃铛

2026-04-01 06:50:32

#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-04-01 06:50:32

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