CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 20

Threaded View

  1. #1
    Join Date
    May 2009
    Location
    Boston
    Posts
    375

    help with complex struct (or class)

    I have some data that I need to be able to store with assignment. This is basically a location to store the value of a float.

    The float is called ET,

    Each data value has three characteristics,
    order (1-4) -> int OR
    type1 (1-100) -> int T1
    type2(1-100) -> int T2

    I am thinking of something along the lines of,

    Code:
       struct values {  
          int type1[100];
          int type2[100];
         float finalValue;
       } order [4];
    I would like to be able to assign something like,

    order[OR].type1[T1].type2[T2].finalValue = ET

    Something like this would self-document the storage location for any combination of order and types. It would also allow for both storage and recovery without evaluating lots of conditionals.

    I know that the struct above is completely wrong, but I can seem to locate how to set this up. This could probably also be done with a multidimensional array, but I would prefer a struct or class. This doesn't seem like it should be all that difficult, but I can't seem to think it though.

    I suppose this is really a kind of search tree, but that is getting beyond the programming I know well.

    LMHmedchem
    Last edited by LMHmedchem; September 29th, 2009 at 04:54 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured