Posted in

C++ Program to convert a decimal number into binary with friend function

Write a program in C++ to convert a decimal number into binary without using an array with a friend function.Decimal to binary C++

If we declare a function friend int show(T4Tutorials_Decimal_Number);  as a friend in a class T4Tutorials_Decimal_Number then this function friend int show(T4Tutorials_Decimal_Number);  can access the private and protected members of the class T4Tutorials_Decimal_Number. You must know that a global function can also be declared as a  friend function of the class.

 

 

Syntax of friend function in C++

class class_name
{

friend return_type function_name(arguments);

}

Output

enter Decimal Number: 9

1001

 CEO @ T4Tutorials.com
I welcome to all of you if you want to discuss about any topic. Researchers, teachers and students are allowed to use the content for non commercial offline purpose. Further, You must use the reference of the website, if you want to use the partial content for research purpose.

Leave a Reply

Contents Copyrights Reserved By T4Tutorials