Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ Language Reference - streams: formatted output http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
   Streams: Formatted Output
   What we have described so far has made no concession to formatting  of
   output. The stream library provides a number of standard functions for
   this purpose.

   For individual items there are:
   char *oct(long, int = 0);
   char *dec(long, int = 0);
   char *hex(long, int = 0);
   char *chr(int, int = 0);
   char *str(char *, int = 0);

   The  second argument determines the field width. The default value  of
   zero  causes  only  as  many character positions to  be  used  as  are
   required.   Values  smaller  than  the  required  length  will   cause
   truncation.  Negative field widths will cause left justification,  and
   positive field widths right justification.

   There is also a function form:
   char *form(char *format...);
   which produces a formatted output string similar to printf:
   cout << form("I have only %d dollars left\n", stake);
   printf("I have only %d dollars left\n", stake);


Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson