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

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

最佳回答

秀丽的咖啡

俊秀的冬天

2026-05-30 21:12: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-05-30 21:12: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是什么意思