tables

This is a discussion on tables within the C Programming forums, part of the General Programming Boards category; I have alreadt tried searching, but [CODE]int main (void) { printf ("\nTable 1: f1\n"); } { printf (" k u1 ...

  1. #1
    Registered User
    Join Date
    Oct 2005
    Posts
    19

    tables

    I have alreadt tried searching, but

    [CODE]int
    main (void)
    {
    printf ("\nTable 1: f1\n");
    }

    {
    printf (" k u1 u2 y \n");
    }
    {
    printf ("********** ********** ********** ********** \n");
    }
    for (k=10; k>=0; k=k*5)
    {
    if (k <= 6250)

    printf ("%d\n", k);
    }
    while (k <= 6250);

    {
    printf ("******************************************* \n");
    }

    [\code]

    I need to know how to place the values in the appropraite areas so it looks like

    10 0.7850 0.7853
    50 0.7850 0.7853
    250 0.7850 0.7853
    1250 0.7850 0.7853
    6250 0.7850 0.7853

  2. #2
    cwr
    cwr is offline
    Registered Luser cwr's Avatar
    Join Date
    Jul 2005
    Location
    Sydney, Australia
    Posts
    869
    Try editing your post so that you have a start [code] and end [/code] tag. Also, your code doesn't make sense, you have a main function declaration, an opening brace, a statement, then a closing brace, then another opening brace, not associated with any function.

    Make an attempt at homework first, then we'll help.
    Last edited by cwr; 10-24-2005 at 01:16 PM. Reason: tag fix

  3. #3
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    Quote Originally Posted by Frank_Rye
    I need to know how to place the values in the appropraite areas so it looks like
    Use the width and precision modifiers with the format specifiers used in your printf statements.

    FAQ > How do I... (Level 1) > Format output using printf() (C)
    Last edited by Dave_Sinkula; 10-24-2005 at 01:00 PM. Reason: Added FAQ link.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C++ style tables
    By MarkZWEERS in forum C++ Programming
    Replies: 4
    Last Post: 05-18-2009, 09:41 AM
  2. Iterable hash tables
    By OnionKnight in forum Tech Board
    Replies: 5
    Last Post: 07-21-2008, 03:02 AM
  3. converting struct to tables in turbo c++
    By geft in forum C++ Programming
    Replies: 4
    Last Post: 02-28-2008, 08:44 AM
  4. String tables in console apps
    By Sentral in forum C++ Programming
    Replies: 3
    Last Post: 10-16-2006, 05:08 AM
  5. Help with beginning hash tables, please.
    By Will in forum C++ Programming
    Replies: 8
    Last Post: 11-17-2002, 09:51 PM

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