Formatting Numbers for Program Output - C++ Language Basics

C++ examples for Language Basics:Console

Introduction

ostream Class Functions

Method Comment Example
precision(n) Equivalent to setprecision()cout.precision(2)
fill('x')Equivalent to setfill() cout.fill('*')
setf(ios::fixed) Equivalent to cout.setf(ios::fixed) setiosflags(ios::fixed)
setf(ios::showpoint) Equivalent to cout.setf(ios::showpoint) setiosflags(ios::showpoint)
setf(ios::left) Equivalent to left cout.setf(ios::left)
setf(ios::right) Equivalent to right cout.setf(ios::right)
setf(ios::flush) Equivalent to endl cout.setf(ios::flush)

Related Tutorials