Thread: Tables in C

  1. #1
    Registered User
    Join Date
    Oct 2012
    Posts
    23

    Tables in C

    Ok so I need to create a table that will hold information. I need the table to be simple, so if someone could just point me to the tutorial for this or write out some code that may work. Pretty much the table would look like this:


    http://www.faqs.org/docs/ZopeBook/Figures/10-1.png

  2. #2
    SAMARAS std10093's Avatar
    Join Date
    Jan 2011
    Location
    Nice, France
    Posts
    2,694
    Have you heard of structs in C?
    You need an array of structs, where every struct will have the members your implementation requires(name,surname,age).
    Alternative : Have three usual arrays,two of strings and on of int and handle them as one.

  3. #3
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Click on the C Tutorial tab at the top of this forum. Then click on "structures". Be sure you understand how to make an array of structures, because that is probably what you will need.

    Do you need to draw that box?

  4. #4
    Registered User
    Join Date
    Oct 2012
    Posts
    23
    Quote Originally Posted by std10093 View Post
    Have you heard of structs in C?
    You need an array of structs, where every struct will have the members your implementation requires(name,surname,age).
    Alternative : Have three usual arrays,two of strings and on of int and handle them as one.
    Thanks!

  5. #5
    Registered User
    Join Date
    Oct 2012
    Posts
    23
    Quote Originally Posted by Adak View Post
    Click on the C Tutorial tab at the top of this forum. Then click on "structures". Be sure you understand how to make an array of structures, because that is probably what you will need.

    Do you need to draw that box?
    Yea id like the boxes to be drawn if thats possible, if not then just an allocated spot for the information in a set of columns and rows would be awesome

  6. #6
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    What is your operating system, and does your compiler support windows.h and conio.h ? If this is for an assignment, be sure the teacher who will be checking your work, also supports windows.h and/or conio.h.

    These two header files have special drawing and positioning functions for the console window.

  7. #7
    Registered User
    Join Date
    Oct 2012
    Posts
    23
    Quote Originally Posted by Adak View Post
    What is your operating system, and does your compiler support windows.h and conio.h ? If this is for an assignment, be sure the teacher who will be checking your work, also supports windows.h and/or conio.h.

    These two header files have special drawing and positioning functions for the console window.

    Im using Linux Ubuntu and writing it with emacs, will be running the script with ROOT, a data analysis tool.

  8. #8
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Quote Originally Posted by dciampa View Post
    Im using Linux Ubuntu and writing it with emacs, will be running the script with ROOT, a data analysis tool.
    I know zip about ROOT (only heard it mentioned a time or two). For linux, console output functions are in either Ncurses or Curses, but whether they work with ROOT or not, I have no idea.

    Maybe best to get the table with rows and good column spacing for now.

    Will you be using a struct with name, age and height then?

    Post up what you have when you get stuck and let us know what you're stuck on.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. tables
    By kgott in forum C Programming
    Replies: 3
    Last Post: 10-19-2006, 09:39 AM
  2. tables...
    By peanut in forum C Programming
    Replies: 21
    Last Post: 10-17-2006, 03:06 PM
  3. tables
    By Frank_Rye in forum C Programming
    Replies: 2
    Last Post: 10-24-2005, 11:57 AM
  4. tables?
    By jobolikescake in forum C++ Programming
    Replies: 6
    Last Post: 09-04-2002, 09:24 PM
  5. tables
    By Lorna in forum C Programming
    Replies: 2
    Last Post: 11-30-2001, 02:47 PM