0% found this document useful (0 votes)
3 views6 pages

Exp 6

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views6 pages

Exp 6

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 6

#include<iostream.

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;

friend void disp(A n);

};

void disp(A n)

cout<<"\nA:"<<n.a<<"\nB:"<<n.b;

void main()

{
A n;

clrscr();

n.accept();

cout<<"\nBefore Swapping :";

disp(n);

n.swap();

cout<<"\nAfter swapping :";

disp(n);

getch();

#include<iostream.h>

#include<conio.h>

class test2;

class test1

int m1;

public :

void accept()

cout<<"\nEnter Marks for M1:" ;


cin>>m1;

void disp()

cout<<"\n Marks :"<<m1;

friend void avg(test1 t1,test2 t2);

};

class test2

int m2;

public:

void in()

cout<<"\nEnter Marks of M2:" ;

cin>>m2;

void out()

cout<<"\n Marks :"<<m2;

friend void avg(test1 t1,test2 t2);

};

void avg(test1 t1,test2 t2)

{
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;

friend void add(calculation c);

friend void sub(calculation c);

friend void mul(calculation c);

friend void div(calculation c);

};

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();

You might also like