0% found this document useful (0 votes)
12 views2 pages

Practical 7

Uploaded by

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

Practical 7

Uploaded by

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

NAME: SADIK SIRAJUDDIN SHAIKH ENROLLMENT NO:23111590394 CLASS:CO3KA

BATCH:3 SUBJECT:OOP PRACTICAL NO:7

PROGRAM: 1
#include<iostream.h>
#include<conio.h>
class abc{
public:
int a,b,i;
public:friend void xyz();};
void xyz(){
abc swap;
swap.a=10;
swap.b=20;
cout<<"before swapping:"<<endl;
cout<<"value of a:"<<swap.a<<endl;
cout<<"value of b:"<<swap.b<<endl;
swap.i=swap.a;
swap.a=swap.b;
swap.b=swap.i;
cout<<"after swapping:"<<endl;
cout<<"exchanged value of a:"<<swap.a<<endl;
cout<<"exchanged value of b:"<<swap.b<<endl;
}
void main(){
clrscr();
xyz();
getch();
}

OUTPUT:
PROGRAM: 2
#include<iostream.h>
#include<conio.h>
class test1{
int mr1;
public: void getdata(){
cout<<"enter marks 1:"<<endl;
cin>>mr1;
}
friend class test2;};
class test2{
int mr2;
public: void getdata1(){
cout<<"enter marks 2:"<<endl;
cin>>mr2;
}
void display(test1 &t)
{
cout<<"avg of two marks="<<(t.mr1+mr2)/2<<endl;
}
};
void main(){
test1 t1;
test2 t2;
clrscr();
t1.getdata();
t2.getdata1();
t2.display(t1);
getch();
}

OUTPUT:

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy