This is a practical question so will try to understand the concept , the question said us to use swap function
This code is error free might only work with turbo C++
#include <iostream.h>
#include<conio.h>
void swap(float &x,float &y)
{
float t=x;
x=y;
y=t;
}
int main()
{void swap(float &x,float &y);
float a,b;
cin>>a>>b;
cout<<"a="<<a<<"b="<<b<<endl;
swap(a,b);
cout<<"a="<<a<<"b="<<b<<endl;
}
We added a output for you to get it clearly