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

By: Prof. Dr. Fazal Rehman | Last updated: May 4, 2020

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

Leave a Comment

All Copyrights Reserved 2025 Reserved by T4Tutorials