Join Our Email Alerts-Subscribe
Important Note:Login & Check Your Email Inbox and Activate Confirmation Link



Enter Your Email :

Copyright Disclaimer:
Section 107 of the Copyright Act Fair Use Contents .
We are forwarding content link(s) from our website to content website & We are not serving any contents.
Main Source:Google.com.All the Content PDF link(s) is/are obtained from GoogleSearch
for the purpose of Education & Teaching Intention. Not for commercial purpose.
Technicalsymposium.com is not liable/responsible for any copyright issues.

C++ Programming Source Codes & Study Notes-Free Download


C++ Program for Friend Functions.

#include<iostream.h>
#include<conio.h>
class Operand2; //forward declaration
class Operand1
{
int a;
public :
void get()
{
cout<<"\n\n\t\tEnter the value of Operand1 : ";
cin>>a;
}
friend void add(Operand1,Operand2);
};
class Operand2
{
int b;
public :
void get()
{
cout<<"\n\n\t\tEnter the value of Operand2 : ";
cin>>b;
}
friend void add(Operand1,Operand2);
};
void add(Operand1 op1, Operand2 op2)
{
/* friend fn to add two numbers*/
cout<<"\n\t\t"<<op1.a<<" + "<<op2.b<<" = "<<op1.a+op2.b;
}
void main()
{
Operand1 op1;
Operand2 op2;
clrscr();
cout<<"\n\n\t\tPROGRAM TO ADD TWO NUMBERS USNIG FRIEND FUNCTION\n\n ";
cout<<"\n\t\tINPUT\n\n";
op1.get();
op2.get();
cout<<"\n\n\t\tOUTPUT\n\n";
add(op1,op2);
getch();
}

 


Programming & Lab Manuals- ebooks & Codes PDF


Software Programming Study Materials PDF-Free Download



Technicalsymposium.com-All Study Materials PDF-Free Download







Technicalsymposium.com-Free Live Support-Chat with Our Experts

Official Contact: +91-9245556793 (Whatsapp Message / SMS / Voice Call)


Our Expert team is ready to answer all your questions immediately-Feel free to speak in Tamil/English.

(Example:Events info/Lecture Notes/Off-Campus & All Jobs/Projects & All education information)

Working hrs (IST): (Morning: 10:00AM-3:00 PM) and (Evening:5:00 PM to 10:00 PM)

All Latest Question & Answer Page (FAQ)-Click here