View Single Post
  #5 (permalink)  
Old 07-07-2007, 04:49 PM
rpgfan3233 rpgfan3233 is offline
PT Staff
Awards Showcase
Quality Tutorial Quality Tutorial Quality Tutorial Quality Tutorial 
Total Awards: 4
Join Date: Jul 2007
Posts: 118
iTrader: (0)
rpgfan3233 has a spectacular aura aboutrpgfan3233 has a spectacular aura aboutrpgfan3233 has a spectacular aura aboutrpgfan3233 has a spectacular aura aboutrpgfan3233 has a spectacular aura about
int printf (char* format, ...);

where format is one of the following:
"%hd" or "%hi" - signed short int
"%hu" - unsigned short int
"%d" or "%i" - signed int
"%u" - unsigned int
"%ld" or "%li" - signed long int
"%lu" - unsigned long int
"%f" - float
"%lf" - double
"%Lf" - long double
"%hx" - unsigned hexadecimal short int (lowercase letters)
"%x" - unsigned hexadecimal int (lowercase)
"%lx" - unsigned hexadecimal long int (lowercase)
"%hX" - unsigned hexadecimal short int (uppercase letters)
"%X" - unsigned hexadecimal int (uppercase)
"%lX" - unsigned hexadecimal long int (uppercase)
"%ho" - signed octal short int
"%o" - signed octal int
"%lo" - signed octal long int
"%c" - single character
"%s" - string of characters (character array, a.k.a. "C(-style) string" or "ASCIIZ string")
"%p" - pointer address
"%n" - nothing printed, but the argument should be a signed int where the number of characters written so far should be stored
"%%" - output a percent (%) sign (since the percent sign is reserved for denoting the position where arguments should be inserted)

I hope that helps. Link for ALL of the specifics of the format string for the printf/scanf family of functions:
printf - C++ Reference

Edit:
Regarding the "illegal default" error, make sure your default case is inside the switch statement and that you closed the switch statement (sometimes you might close the switch statement accidentally or leave it open when it shouldn't be).

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!

Last edited by rpgfan3233 : 07-07-2007 at 04:55 PM.
Reply With Quote
The Following 2 Users Say Thank You to rpgfan3233 For This Useful Post:
HelloWorld (07-07-2007), TeraTask (07-07-2007)