July 29, 2011

C++ Progtam to Interchange the Value of Four Variables

C++ Progtam to Interchange the Value of Four Variables.
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.. :)

Related Posts :



Categories:

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Related Posts with Thumbnails