summary11 - If this flag is set, a plus sign is output...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Magic Formula for formatting money: cout.setf(ios::fixed); cout.setf(ios::showpoint); cout.precision(2); Summary Ch 5.2 Chapter 5.2 Tools for Stream I/O Precision – formats a decimal with a specified amount of digits after the decimal point o Ex: 2.4 setprecision(1) Flag Meaning Default ios::fixed If this flag is set, floating-point numbers are not written in e-notation. Not set ios::scientific If this flag is set, floating-point numbers are written in e-notation. If neither ios::fixed nor ios::scientific is set, then the system decides how to output each number. Not set ios::showpoint If this flag is set, a decimal point and trailing zeroes are always shown for floating-point numbers. If it is not set, a number with all zeros after the decimal point might be output without the decimal point and following zeros. Not set ios::showpos
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: If this flag is set, a plus sign is output before positive integer values Not set ios::right If this flag is set and some field-width value is given with a call to the member function width, then the next item output will be at the right end of the space specified by width. In other words, any extra blanks are placed before the item output. Set ios::left If this flag is set and some field-width value is given with a call to the member function width, then the next item output will be at the left end of the space specified by width. In other words, any extra blanks are placed after the item output. Not set Check for the end of a file by in_stream >> next as both an action and Boolean condition. Whether to place using directives at the beginning of program or inside functions...
View Full Document

This note was uploaded on 08/26/2009 for the course CS 140 taught by Professor Staff during the Fall '08 term at Southern Illinois University Edwardsville.

Ask a homework question - tutors are online