Exp 6
Exp 6
h>
#include<conio.h>
class A
int a,b;
public :
void accept()
cout<<"\nENter 2 Nos.:" ;
cin>>a>>b;
void swap()
int t=a;
a=b;
b=t;
};
void disp(A n)
cout<<"\nA:"<<n.a<<"\nB:"<<n.b;
void main()
{
A n;
clrscr();
n.accept();
disp(n);
n.swap();
disp(n);
getch();
#include<iostream.h>
#include<conio.h>
class test2;
class test1
int m1;
public :
void accept()
void disp()
};
class test2
int m2;
public:
void in()
cin>>m2;
void out()
};
{
cout<<"\nAverage :"<<(t1.m1+t2.m2)/2;
void main()
test1 t1;
test2 t2;
clrscr();
t1.accept();
t2.in();
t1.disp();
t2.out();
avg(t1,t2);
getch();
#include<iostream.h>
#include<conio.h>
class calculation
int a,b;
public :
void accept()
{
cout<<"\nEnter 2 Nos.:" ;
cin>>a>>b;
void disp()
cout<<"\nA:"<<a<<"\nB:"<<b;
};
void add(calculation c)
cout<<"\nADDITION :"<<c.a+c.b;
void sub(calculation c)
cout<<"\nSUBSTRACTION :"<<c.a-c.b;
void mul(calculation c)
cout<<"\nMULTIPLICATION :"<<c.a*c.b;
void div(calculation c)
cout<<"\nDIVSIOM :"<<c.a/c.b;
}
void main()
calculation c;
clrscr();
c.accept();
c.disp();
add(c);
sub(c);
mul(c);
div(c);
getch();