extension joomla, template joomla,banner extension joomla,jomla slider,slider joomla
C++ Tutorial: Standard Manipulators
It is seen that for formatted input/output the stream class ios function are used. To call ios function for formatting, we need to write separate statement and call the function through stream objects cin and cout. Manipulators are the formatting function for input/output that are embedded directly into the C++ input/output statements so that extra statements are not required. Manipulators are used along with the extraction >> and insertion << operators for stream input and output formatting. According to the number of arguments to be supplied manipulators are categorized in the  following types.
  1. Non-parameterized Manipulators
  2. Parameterized Manipulators
Non parameterized Manipulators do no take argument to control the formatting of input/output where as parameterized manipulators take argument for formatting. The Following table shows different non parameterized manipulators.
ManipulatorEffect produced
leftsets ios::left flag of ios::adjustfield
rightsets ios::right flag of ios::adjustfield
internalsets ios::internal flag of ios::adjustfield
decsets ios::dec flag of ios::adjustfield
hexsets ios::hex flag of ios::adjustfield
octsets ios::oct flag of ios::adjustfield
scientificsets ios::scientific flag of ios::floatfield
fixedsets ios::fixed flag of ios::floatfield
showbasesets ios::showbase flag
noshowbaseresets ios::showbase flag
showpointsets ios::showpoint flag
noshowpointresets ios::showpoint flag
showpossets ios::showpos flag
noshowposresets ios::showpos flag
uppercasesets ios::uppercase flag
nouppercaseresets ios::uppercase flag
skipwssets ios::skipws flag
noskipwsresets ios::skipws flag
boolalphasets ios::boolalpha flag
noboolalpharesets ios::boolalpha flag
unitbufsets ios::unitbuf flag
nounitbufresets ios::unitbuf flag
endloutput newline and flush
endsouput ‘’ character
flushflush the stream, same as ostream::flush
wsremoves all white space from input stream until non white space character.
Following table shows different parameterized manipulators
ManipulatorsEffect produced
setw(int n)equivalent to ios function width()
setprecision (int n)equivalent to ios function precision()
setfill(int c)equivalent to ios::function fill()
setbase (int b)sets base for integer output, argument 0 is passed for decimal, 8 or octal, 10 for decimal and 16 for hexadecimal.
setiosflags(ios::fmtflags f)equivalent to ios function setf()
resetiosflags(ios::fmtflags f)equivalent to ios function unsetf()

Related Article

destination source:https://www.programming-techniques.com/?p=165