Thread: Help with formatting

  1. #1
    Registered User
    Join Date
    Apr 2008

    Help with formatting

    I'm doing a basic program where you look a players number and thier stats appear. now i could just try and format the thing by hand but i was wondering if thier was a way i could format something to look like this auto.
    year team g gp a fourth. im not looking for a code(but will accept one happily) but rather a pointer on what i should focus on?

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Hint: \t.

  3. #3
    Registered User
    Join Date
    Apr 2008
    Maybe you could look at the length of each field (i.e. the information you get from the file) and then add a number of spaces based on wanting a total length for the field, i.e. something like:
    int inpLength=stringSize(input);
    int spaces=totalFieldSize-inpLength;

    The functions are ficticious, but..

  4. #4
    Registered User
    Join Date
    Apr 2008
    alright, i mean i got alot a time to try and figure out something simpler if there is anything. thank you

  5. #5
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Or get printf() to do it for you.

    printf("%20s", input);

    Ensures input is atleast 20 characters long, padding with spaces. See

    I'd rather use tabs in this case

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. dos game help
    By kwm32 in forum Game Programming
    Replies: 7
    Last Post: 03-28-2004, 06:28 PM
  2. Need a hand formatting numbers.
    By Furious_George in forum C++ Programming
    Replies: 10
    Last Post: 10-15-2003, 10:12 AM
  3. Formatting Standards
    By subdene in forum A Brief History of
    Replies: 20
    Last Post: 11-22-2002, 04:36 PM
  4. Need help with something small - formatting problem
    By wireless in forum C++ Programming
    Replies: 0
    Last Post: 05-28-2002, 05:52 PM
  5. Problem Formatting double numbers.
    By chaps67 in forum C++ Programming
    Replies: 1
    Last Post: 09-19-2001, 09:20 AM