=46rom standard library you can use map, etc. =0D
=0D
=0D
=0D
Ioannis Vranos=0D
=0D
* Programming pages: http://www.noicys.freeurl.com=0D
* Alternative URL: http://run.to/noicys =0D
=0D
=0D
-------Original Message-------=0D
=0D
From: Daniel Glenfield=0D
Date: Wednesday, 15 January 2003 5:59:53 PM=0D
To: dev...@li...=0D
Subject: [Dev-C++] Lookup tables, with bsearch, lsearch, qsort etc.=0D
=0D
I'm trying to understand lookup tables and the bsearch, lsearch, qsort =0D
functions. I'm trying to create a structure with an integer and a text =0D
string, and I want to look up the number and get the text associated with=
=0D
it. for example, at the moment I have=0D
=0D
// BIG switch here=0D
switch (PaperSize) // can be 1 - 41=0D
{=0D
case 1: ListBox =3D "Paper Type: Letter";=0D
Listbox->AddString(ListBoxChoice);=0D
break;=0D
=0D
case 2: //... the same again=0D
//...=0D
case 41: // same again=0D
=0D
=0D
I'm trying to replace this with a lookup table but I'm finding it difficu=
lt =0D
- examples on the net about bsearch are not quite what I need.
|