lect03_Formatting

lect03_Formatting - Output Formatting Output Formatting...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
utput Formatting Output Formatting SIS1117 Computer Programming CS S Co pute og a g 1 c1117 lecture 3
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
ontent Content utput Formatting Output Formatting c1117 lecture 3 2
Background image of page 2
ormatting your Output Formatting your Output here are 4 parts in an output field: There are 4 parts in an output field: width – width of the field ll ll character usually blank fill – fill character, usually blank flag – how to format recision umber of significant figures precision – number of significant figures. c1117 lecture 3 3
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
width and fill dt a d o set the width and fill, use the function To set the width and fill, use the function cout.width() and cout.fill() function g E.g. cout.width(4); //min 4 chars used cout.fill(’#’); //fill the remaining space with # out < ” b ; cout << ab ; The output is ##ab c1117 lecture 3 4
Background image of page 4
he default fill character is space (blank). The default fill character is space (blank). The default size is 0 (meaning as many char as
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 13

lect03_Formatting - Output Formatting Output Formatting...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online