Thread: printf
View Single Post
  #10   Spotlight this post!  
Unread 18-02-2007, 16:38
Tureyhall Tureyhall is offline
Registered User
AKA: Thomas Hall
FRC #0668 (Apes Of Wrath)
Team Role: Programmer
 
Join Date: Feb 2006
Rookie Year: 2004
Location: San Jose
Posts: 40
Tureyhall will become famous soon enoughTureyhall will become famous soon enough
Re: printf

Quote:
Originally Posted by Andrew Blair View Post
On the topic, can someone describe to me what all the calls mean? /r, /n, d%, %3d, etc?

Always been a mystery to me... I just copy pasta typically.
\r - return character, moves cursor to beginning of current line.
\n - newline character, moves cursor down by one.

%d is for ints. You can search online for other variable types. This will display the entire variable.

%3d means display a int three digits in length.

%.3f means display a float with as many digits before the decimal as it needs, but limit it to three digits after the decimal.

%3.2f means display a float with three digits before the decimal, and two digits after the decimal.


All this is off of the top of my head, and may not be correct.


P.S. I like copying pasta as well. Yummy pasta.
__________________
/*Nerd Camouflage*/

2005 SVR - 668+1072+840 - Semifinalists.
2006 SVR - 668+1280+1693 - Finalists.
2007 SVR - 668+604+624 - Quarter-finalists, Xerox Creativity Award, two highest scores (290-2, 128-0) at SVR.
2007 Nat's - TBA.