Storing fields in a Array

Posted on 2004-11-28
Last Modified: 2010-04-17
I have six fields having a list of values or records.
How can i store these values in a single array ,so that for
a particular index i should get the entire row...values of six fields
for a particular index.
Is STL provides collection classes for storing numerous fields..?
Question by:kallzz
    1 Comment
    LVL 55

    Accepted Solution

    You can create vector of vectors:

    typedef vector<string> TRecord;

    vector<TRecord> allData;

    Or, if you have a fixed record structure just create a struct:

    typedef struct {
       string text1;
       string text2;
       int numeric1;
       int numeric2;
       float currency1;
       float currency2;
    } TRecord;

    vector<TRecord> allData;


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Suggested Solutions

    This is an explanation of a simple data model to help parse a JSON feed
    Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now