Loading...
「ツール」は右上に移動しました。
利用したサーバー: wtserver1
3いいね 10 views回再生

MANIPULATOR IN OOP|| C++ PROGRAMING||

Manipulators are the operators used with the insertion operator to modify or manipulate the way data is displayed.
The most commonly used manipulators are endl, setw, and setprecision. Manipulators are defined in the header file "#include(iomanip)" , therefore we need to include it before using manipulators.
Manipulator "endl" is also defined in iostream therefore if we want to use only "endl", we do not need to include "iomanip".


1. The endl Manipulator
This manipulator causes a linefeed to be inserted into the output stream.
It has same effect as using the newline character ‘\n’.
“endl” is different from newline character ‘\n’ in the sense that it causes output buffer to be cleared after the content is displayed in the monitor but ‘\n’ lefts the output buffer uncleared due to which we need to clear the buffer by using the other instructions.

2. The setw Manipulator
This manipulator causes the output stream that follows it to be printed within a field of n characters wide, where n is the argument to setw. The output is right justified within the field. If we do not use setw, the output is left justified by default and it occupies the space in the monitor equal to number of characters in it.

3. The setprecision Manipulator
This manipulator sets the n digits of precision to the right of the decimal point to the floating point output, where n is the argument to setprecision (n).
#Programming
#Coding
#DeveloperLife
#TechTalk
#CodeSnippet
#SoftwareDevelopment
#WebDevelopment
#CodeNewbie
#ProgrammingTips
#LearnToCode

コメント