Thread: Displaying all zeros?

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    11

    Lightbulb Displaying all zeros?

    I'm working on a program... pretty much completed it except that theres a tad boo-boo that I can't figure out.

    Basically, I was told that when I input (scanf) more than 1 zero, it would display (printf) only one zero unless I did something like %0d.

    This is part of what I have:

    Code:
    printf ("%0d  Some text here %0d", value1, value2);
    Now let's just say that I've inputed 000 for value1 and 00 for value2.

    This would result into:

    "0 Some text here 0"

    What I need to achieve is:
    "000 Some text here 00"

    Anyone know what I'm doing wrong? I'm positive all the printf variables are at %0d.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    %0xd

    where x is the number of zeros you want.

    Ie:

    printf("%05", 30 );

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Oct 2001
    Posts
    11
    Wow, so that was all I was missing?

    I knew I was missing something *sigh*.

    Thanks alot, that worked!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 12
    Last Post: 04-12-2009, 05:49 PM
  2. Displaying zeros
    By ATL in forum C++ Programming
    Replies: 1
    Last Post: 03-04-2008, 08:49 AM
  3. leading zero's..... ( reading int )
    By sh4k3 in forum C Programming
    Replies: 4
    Last Post: 06-12-2007, 09:03 AM
  4. Need Help Displaying A Pattern.
    By slickwilly440 in forum C++ Programming
    Replies: 4
    Last Post: 10-05-2005, 11:01 AM
  5. Need codes for displaying figures in descending mode.
    By rbaba in forum C++ Programming
    Replies: 0
    Last Post: 12-14-2001, 08:47 PM