Thread: displaying tables

  1. #1
    Registered User
    Join Date
    May 2009
    Posts
    6

    displaying tables

    i need help in displaying data in a table format...does anyone know the code or syntax to keep the columns aligned?
    my prof said something about a setY syntax, but i can't seem to find the code on the internet. can someone help me?

  2. #2
    DESTINY BEN10's Avatar
    Join Date
    Jul 2008
    Location
    in front of my computer
    Posts
    804
    If I understood your query, then I think using width specifier for the values taken up by the column variable will keep it aligned.
    HOPE YOU UNDERSTAND.......

    By associating with wise people you will become wise yourself
    It's fine to celebrate success but it is more important to heed the lessons of failure
    We've got to put a lot of money into changing behavior


    PC specifications- 512MB RAM, Windows XP sp3, 2.79 GHz pentium D.
    IDE- Microsoft Visual Studio 2008 Express Edition

  3. #3
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by BEN10 View Post
    If I understood your query, then I think using width specifier for the values taken up by the column variable will keep it aligned.
    Eg.
    Code:
    printf("%10d %10d %10s %10d %10d\n",12,666,"word",4,9099);
    printf("%10d %10d %10s %10d %10d\n",1,66,"word xy",400,90);
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

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, 08:41 AM
  2. Replies: 12
    Last Post: 04-12-2009, 05:49 PM
  3. Problem Displaying a Struct
    By rockstarpirate in forum C++ Programming
    Replies: 16
    Last Post: 05-05-2008, 09:05 AM
  4. converting struct to tables in turbo c++
    By geft in forum C++ Programming
    Replies: 4
    Last Post: 02-28-2008, 08:44 AM
  5. String tables in console apps
    By Sentral in forum C++ Programming
    Replies: 3
    Last Post: 10-16-2006, 04:08 AM