C Programming

These notes are in addition to the text book used in the class of BAA2013 Computer Programming in C++.

Wednesday, May 10, 2006

output special characters and format

Special characters



Character sequence
Result

\n
Moves cursor to next line (same effect as endl

\t
Generates a tab character to move the cursor to the next tab stop

\\
Prints a backslash (\)

\’
Prints a single quotation mark (‘)

\”
Prints a double quotation mark (“)







Formatting options


Option
Description

left
Left justifies the output

right
Right justifies the output

showpoint
Displays decimal point and trailing zeros for all floating point numbers, even if the decimal places are not needed

uppercase
Desplays the “e” in E-notation as “E” rather than “e”

showpos
Desplays a leading plus sign before positive values

scientific
Displays floating point numbers in scientific (“E”) notation

fixed
Displays floating point numbers in normal notation

0 Comments:

Post a Comment

<< Home