# C++ Programming Code Examples

## C++ > Conversions Code Examples

You will learn to convert "binary number" to octal, and octal number to binary manually by creating a "user-defined" function. In this, first convert the binary number to "decimal".

Fahrenheit & Celsius are two unit for measure temperature. Formula to convert "Celsius" to Fahrenheit using this formula you can change temperature fahrenheit to celsius. Use temp

In the program, the octal number is stored in the variable octalNumber, passed to function octalToDecimal(). This function converts the octal number passed by user to its equivalent

Enter any number in binary to convert it into decimal, then display the equivalent decimal value on the output screen as shown here in the following program. In C++ program code

To convert binary to hexadecimal in C++, you have to ask to the user to "enter any number" in binary to convert it into hexadecimal, then display the equivalent hexadecimal value on

To convert binary to octal in C++, you have to ask to the user to enter any number in binary to "convert it into octal" to display equivalent value in octal on the screen as shown in code

To "convert temperature" from centigrade to Fahrenheit in the C++, you have to ask to the user to enter the temperature in "centigrade" to convert it into Fahrenheit (using fah = (1.8

In the program, the decimal number is stored in the variable decimalNumber and passed to function decimalToOctal(). Function converts the 'decimal number' passed to its equivalent

To convert decimal number to binary number in C++, you have to enter the decimal number to convert it into 'binary number' to print the equivalent value in binary format as shown in

In C++ programming, you have to ask to the user to enter the desired decimal number to convert it into hexadecimal number to print the equivalent value in hexadecimal format

To convert decimal number to octal number in C++ programming, you have to ask to the user to enter the decimal number to convert it into octal number to display the equivalent

To convert temperature from "Fahrenheit" to centigrade in C++, enter the "temperature" in Fahrenheit to convert it to centigrade to print equivalent temperature value in "centigrade"

To convert "Hexadecimal" number to "binary" number in C++, you have to ask to the user to enter the hexadecimal number to convert it into binary number to display the equivalent

To convert a number from "hexadecimal" into equivalent decimal format "in C++", enter the hexadecimal number to convert it to decimal to display the equivalent value in "decimal" as

Program ask to the user to enter any number in Hexadecimal to convert it into octal, then display the result on the screen: Here first we will convert the entered hexadecimal number

To convert octal number to binary number in C++, you have to ask to the user to enter the octal number to convert it to binary number to display the "equivalent value" in binary as

To convert octal number to decimal number in C++ programming, you have to ask to the user to enter the octal number to convert it into decimal number to print the equivalent

To convert octal number to "hexadecimal" in C++, you have to ask to the user to enter the octal number to convert it into hexadecimal to print the equivalent value in hexadecimal

Page 1 Page 2