You are on page 1of 1

EXP6_2 #include<iostream.h> #include<conio.

h> class ty; class sy { public: int var1; void getdata() { cin>>var1; } void putdata() { cout<<endl<<var1; } friend void xchng(sy&,ty&); }; class ty { public: int var2; void getdata() { cin>>var2; } void putdata() { cout<<endl<<var2; } friend void xchng(sy&,ty&); }; void xchg(sy&s,ty&t) { int temp; temp=s.var1; s.var1=t.var2; t.var2=temp; } void main() { clrscr(); sy s1; ty t1; cout<<"Enter any two numbers:\n"; s1.getdata(); t1.getdata(); xchg(s1,t1); cout<<"Values after swapping:\n"; s1.putdata(); t1.putdata(); getch(); }

Page 1

Print to PDF without this message by purchasing novaPDF (http://www.novapdf.com/)