Skip to content

C++ Progtam to Interchange the Value of Four Variables

C++ Progtam to Interchange the Value of Four Variables.
The code is shared with us by Akshay Durge



Sample Output:





Code:

//Progtam to interchange the value of four variables x,y,z,w
#include<iostream.h>
#include<conio.h>
int main()
{
clrscr();
int x,y,z,w;
void intchange(int,int,int,int);      //prototype void
cout<<“Enter values for x,y,z,w”<<endl;
cin>>x>>y>>z>>w;
intchange(x,y,z,w);           //calling the function
getch();
return(0);
}
void intchange(int x,int y,int z,int w)  //function intchange with argument having four variable
{
int temp=x;
x=w;
w=z;
z=y;
y=temp;
cout<<“new x=”<<x<<endl;
cout<<“new y=”<<y<<endl;
cout<<“new z=”<<z<<endl;
cout<<“new w=”<<w;
}

Comment bellow for your query and feedback.. 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

error: Content is protected !!