472,368 Members | 2,422 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,368 software developers and data experts.

How to build lookup table with an array as one of the elements?

Hi,

I need to build a BAUDOT lookup table for an encoder. I see to use a
char as the index 'A' or 'B' and get back an array of booleans (five
elements long).

Baudot['A'] = {00011}
Baudot['B'] = {11001}

Can someone give me a pointer on how to build this as a static lookup
table?

Do I want an array of arrays?

public static bool [][] = {'A', {0, 0, 0, 1, 1, 1} };

This isn't right because an A is not a bool.

Maybe an array of structures?

How do I initiale the structure boolean array?

Thanks,
John
Nov 15 '05 #1
3 2341
John <jo********@hotmail.com> wrote:
I need to build a BAUDOT lookup table for an encoder. I see to use a
char as the index 'A' or 'B' and get back an array of booleans (five
elements long).

Baudot['A'] = {00011}
Baudot['B'] = {11001}

Can someone give me a pointer on how to build this as a static lookup
table?


It sounds to me as if you don't want an array, you want a map - look at
Hashtable.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #2

Hi John,

I think you can do something like this:

Hashtable ht=new Hashtable();
ht.Add('A',new byte[]{0,0,0,1,1});
ht.Add('B',new byte[]{1,1,0,0,1});
byte [] arr1=(byte[])ht['A'];
byte [] arr2=(byte[])ht['B'];

Hope this helps,

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| From: jo********@hotmail.com (John)
| Newsgroups: microsoft.public.dotnet.languages.csharp
| Subject: How to build lookup table with an array as one of the elements?
| Date: 27 Oct 2003 11:49:10 -0800
| Organization: http://groups.google.com
| Lines: 24
| Message-ID: <d8**************************@posting.google.com >
| NNTP-Posting-Host: 192.25.240.225
| Content-Type: text/plain; charset=ISO-8859-1
| Content-Transfer-Encoding: 8bit
| X-Trace: posting.google.com 1067284150 20939 127.0.0.1 (27 Oct 2003
19:49:10 GMT)
| X-Complaints-To: gr**********@google.com
| NNTP-Posting-Date: Mon, 27 Oct 2003 19:49:10 +0000 (UTC)
| Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed 00.sul.t-online.de!t-onlin
e.de!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!postnew s1.google.com!no
t-for-mail
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:194480
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| Hi,
|
| I need to build a BAUDOT lookup table for an encoder. I see to use a
| char as the index 'A' or 'B' and get back an array of booleans (five
| elements long).
|
| Baudot['A'] = {00011}
| Baudot['B'] = {11001}
|
| Can someone give me a pointer on how to build this as a static lookup
| table?
|
| Do I want an array of arrays?
|
| public static bool [][] = {'A', {0, 0, 0, 1, 1, 1} };
|
| This isn't right because an A is not a bool.
|
| Maybe an array of structures?
|
| How do I initiale the structure boolean array?
|
| Thanks,
| John
|

Nov 15 '05 #3
Thanks!

""Jeffrey Tan[MSFT]"" <v-*****@online.microsoft.com> wrote in message
news:uN**************@cpmsftngxa06.phx.gbl...

Hi John,

I think you can do something like this:

Hashtable ht=new Hashtable();
ht.Add('A',new byte[]{0,0,0,1,1});
ht.Add('B',new byte[]{1,1,0,0,1});
byte [] arr1=(byte[])ht['A'];
byte [] arr2=(byte[])ht['B'];

Hope this helps,

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| From: jo********@hotmail.com (John)
| Newsgroups: microsoft.public.dotnet.languages.csharp
| Subject: How to build lookup table with an array as one of the elements?
| Date: 27 Oct 2003 11:49:10 -0800
| Organization: http://groups.google.com
| Lines: 24
| Message-ID: <d8**************************@posting.google.com >
| NNTP-Posting-Host: 192.25.240.225
| Content-Type: text/plain; charset=ISO-8859-1
| Content-Transfer-Encoding: 8bit
| X-Trace: posting.google.com 1067284150 20939 127.0.0.1 (27 Oct 2003
19:49:10 GMT)
| X-Complaints-To: gr**********@google.com
| NNTP-Posting-Date: Mon, 27 Oct 2003 19:49:10 +0000 (UTC)
| Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed 00.sul.t-online.de!t-onlin e.de!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!postnew s1.google.com!no t-for-mail
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:194480 | X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| Hi,
|
| I need to build a BAUDOT lookup table for an encoder. I see to use a
| char as the index 'A' or 'B' and get back an array of booleans (five
| elements long).
|
| Baudot['A'] = {00011}
| Baudot['B'] = {11001}
|
| Can someone give me a pointer on how to build this as a static lookup
| table?
|
| Do I want an array of arrays?
|
| public static bool [][] = {'A', {0, 0, 0, 1, 1, 1} };
|
| This isn't right because an A is not a bool.
|
| Maybe an array of structures?
|
| How do I initiale the structure boolean array?
|
| Thanks,
| John
|

Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Sims | last post by:
Hi I have a table with something like ID PARENT 0 | -1 1 | -1 2 | 1 3 | 1
6
by: Neal D. Becker | last post by:
I need a fairly small lookup table, and I'm wondering which data python data structure would be fastest. I could use a list, tuple, dictionary, numeric array, or maybe plain python array. The...
11
by: John Collyer | last post by:
Hi, In assembly language you can use a lookup table to call functions. 1. Lookup function address in table 2. Call the function Like: CALL FUNCTION
25
by: kie | last post by:
hello, i have a table that creates and deletes rows dynamically using createElement, appendChild, removeChild. when i have added the required amount of rows and input my data, i would like to...
10
by: Douglas Buchanan | last post by:
I am using the following code instead of a very lengthly select case statement. (I have a lot of lookup tables in a settings form that are selected from a ListBox. The data adapters are given a...
3
by: Julius Mong | last post by:
Hi all, I'm doing this: // Test char code wchar_t lookup = {0x8364, 0x5543, 0x3432, 0xabcd, 0xef01}; for (int x=0; x<5; x++) { wchar_t * string = (wchar_t*) malloc(sizeof(wchar_t)); string =...
2
by: Edward | last post by:
The below code builds 2 tables 4 rows by 4 cols. All cells have checkboxes. When checked, the checkboxes in the first column automatically check the remainder of the check boxes in the same row. ...
2
by: Joe Reed | last post by:
I need to populate either an array or table with the following date information. These dates are used to build an effort number based on what month a records subscription expires. Drop9_Start:...
6
by: pj | last post by:
Hi, I 'm currently writing a program that performs transliteration (i.e., converts greek text written using the english alphabet to "pure" greek text using the greek alphabet) as part of my...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.