Thread: how to access a table

  1. #1
    Registered User
    Join Date
    May 2002
    Posts
    1

    Question how to access a table

    can anyone help me with a basic problem . I have only just started learning c++ and don,t know how to write the coding to acess a table such as .
    struct ConvType
    {
    AnsiString Unit1;
    AnsiString Unit2;
    Float Unit1Equivalent;
    Float Unit2Equivalent;
    };

    ConvType Table[6];

    What would i write to list the contents of the units 1 and 2.

  2. #2
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    int i = 0;

    cout << Table[i].Unit1 << endl;



    If you want all Unit1's, use a for loop to put "i" through 0 to 5.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Writing array, to file
    By zootreeves in forum C Programming
    Replies: 9
    Last Post: 09-08-2007, 05:06 PM
  2. random access function table design?
    By talz13 in forum C++ Programming
    Replies: 2
    Last Post: 01-07-2005, 03:30 PM
  3. progarm doesnt compile
    By kashifk in forum Linux Programming
    Replies: 2
    Last Post: 10-25-2003, 05:54 PM
  4. extra word printing
    By kashifk in forum C++ Programming
    Replies: 2
    Last Post: 10-25-2003, 04:03 PM
  5. inputting words from a file
    By kashifk in forum C++ Programming
    Replies: 5
    Last Post: 10-24-2003, 07:18 AM