Popular Google Pages:
◕ Send your story to RiyaButu.com and get ₹ 500/- Details..
◕ Bengali Story writing competition. Details..
This article is regarding How to display a value in Octal form in C++?
Last updated on: 06th December 2016.
◕ How to display a value in Octal form in C++?
- If we want to display a value in Octal form we have to use some special features of cout. For an example, the iostream header file provides the endl manipulator to give cout the message to start a new line. Similarly, it provides the oct manipulators to give cout the messages to display integers in Octal form.
■ The example is given bellow.
Let we have a program like this:
using namespace std;
int road = 13; // this is in Decimal form
cout << oct;
cout << "Displaying Decimal in Octal form: " << road << endl;
The output is:
Displaying Decimal in Octal form: 15
The code cout << oct; doesn’t display anything onscreen. Instead, it changes how the cout will display the integers in Octal. This oct is a Manipulator. This manipulator gives a message to cout which tells it how to behave with the integer.
How to display a value in Hexadecimal form in C++?
How to display a value in Octal form in C++?
How C++ identify the base of a number?
Top of the page