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

Latest posts by Prof. Fazal Rehman Shamil (see all)