Function succeeded, all changed

#include<iostream>
using namespace std;
void swap(int &x,int& y)
{
    
    
int temp;
temp=x;
x=y;
y=temp;
cout <<x<< " " <<y<< endl;
}

int main()
{
    
    
int a=10,b=50;
swap(a,b);
cout <<a<< " " <<b<< endl;
return 0;
}

Guess you like

Origin blog.csdn.net/qq_51082388/article/details/112010466