Thread: Lookup table help

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Dec 2007
    Posts
    932

    Lookup table help

    Can you read this kind of way a lookup table or it has to be a multidimensional array mixing the corresponding values one after the other?

    Code:
    #include <string>
    #include <iostream>
    using namespace std;
    
    static const char lookup[17] = "0123456789:;<=";
    
    static const char *Hex[] ={
    "0x60","0x61","0x62","0x63","0x64",
    "0x65","0x66","0x67","0x68","0x69",
    "0x71","0x72","0x73","0x74","0x75"
    };
    
    int main()
    {
        cout << Hex[lookup[13]] << endl;
    
           return 0;
    }
    Last edited by Ducky; 10-27-2011 at 11:03 AM.
    Using Windows 10 with Code Blocks and MingW.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. lookup table mappings
    By robi in forum C Programming
    Replies: 5
    Last Post: 10-19-2011, 12:25 PM
  2. quick log lookup table
    By R.Stiltskin in forum C++ Programming
    Replies: 19
    Last Post: 12-04-2008, 12:39 PM
  3. Making a lookup table?
    By username101 in forum C Programming
    Replies: 7
    Last Post: 05-09-2008, 09:10 AM
  4. using a shared lookup table
    By zxcv in forum C Programming
    Replies: 1
    Last Post: 02-21-2008, 12:10 AM
  5. Table Lookup Processing
    By muffin in forum C Programming
    Replies: 1
    Last Post: 08-29-2001, 12:07 PM