Output formatting

This is a discussion on Output formatting within the C Programming forums, part of the General Programming Boards category; How to format out put so as to print it like this Code: The value is: 34567 The second value: ...

  1. #1
    Registered User
    Join Date
    Jul 2002
    Posts
    5

    Output formatting

    How to format out put so as to print it like this

    Code:
    The value is:                       34567
    The second value:                      1
    The third value is:                   345
    The name of the prog:      mop
    I'm just frustrated over this ..can some1 help me?
    Thanks
    Last edited by Beginner2002; 09-05-2002 at 07:55 PM.

  2. #2
    Registered User
    Join Date
    Sep 2002
    Posts
    4
    Er...I really don't understand what you are asking but http://www.cplusplus.com/ref/cstdio/printf.html has helped me out alot with formatting. See the example program at the bottom of that page.

  3. #3
    moi
    moi is offline
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946
    well where are these values coming from?
    hello, internet!

  4. #4
    Registered User datainjector's Avatar
    Join Date
    Mar 2002
    Posts
    356

    its easy

    printf ("%3d", eg );

    prints the number 3 spaces to the right

    so u could say

    printf ("%10d",eg )
    and it would print it 10 spaces to the right

    Code:
    example1)   .
    example2)          .

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Switch statement and returning the correct output
    By slowcoder in forum C Programming
    Replies: 6
    Last Post: 09-28-2006, 05:00 PM
  2. Formatting output to screen from a file
    By clearrtc in forum C Programming
    Replies: 2
    Last Post: 08-20-2006, 04:19 PM
  3. Base converter libary
    By cdonlan in forum C++ Programming
    Replies: 22
    Last Post: 05-15-2005, 02:11 AM
  4. dos game help
    By kwm32 in forum Game Programming
    Replies: 7
    Last Post: 03-28-2004, 06:28 PM
  5. formatting output
    By spliff in forum C Programming
    Replies: 2
    Last Post: 08-14-2001, 07:50 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21