Re: [Dev-C++] Lookup tables, with bsearch, lsearch, qsort etc.
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Daniel G. <sp...@ho...> - 2003-01-16 09:08:42
|
Thanks I'll do some research.
Can you tell me how to put these values in to a struct?
1, "Letter"
2, "Letter(small)"
3, "Tabloid"
etc. I'm having trouble with this.
struct PAPER
{
int Num;
char* PaperStrings[42][1];
} PaperTypes, *PaperStruct = &PaperTypes;
PaperTypes.Num = 1;
PaperTypes.PaperStrings[42][1] = "Letter";
PaperStruct->PaperStrings[40][1] = "Letter(small)";
As you can see this is very wrong. I feel an idiot, but all the examples of
structs I have seen do not use arrays or do anything like this, so I don't
know how to do it!
Can you help?
>From: Per Westermark <pw...@ia...>
>To: Daniel Glenfield <sp...@ho...>
>CC: dev...@li...
>Subject: Re: [Dev-C++] Lookup tables, with bsearch, lsearch, qsort etc.
>Date: Thu, 16 Jan 2003 10:43:12 +0100 (CET)
>
>In MFC applications, you might decide to use CMap instead.
>
>/Per W
>
>On Thu, 16 Jan 2003, Daniel Glenfield wrote:
>
> > I'll have to go look all these up. I want to try the lookup table
>because it
> > was recommended by a peer, and I don't know how to do it so two very
>good
> > reasons there.
> > I'm using MFC, is STL included with that or do I need to #include some
> > header files?
> >
> >
> > >From: "Ioannis Vranos" <no...@ho...>
> > >To: <dev...@li...>
> > >Subject: Re: [Dev-C++] Lookup tables, with bsearch, lsearch, qsort etc.
> > >Date: Wed, 15 Jan 2003 18:27:19 +0200 (GTB Standard Time)
> > >
> > >From standard library you can use map, etc.
> > >
> > >
> > >
> > >Ioannis Vranos
> > >
> > >* Programming pages: http://www.noicys.freeurl.com
> > >* Alternative URL: http://run.to/noicys
> > >
> > >
> > >-------Original Message-------
> > >
> > >From: Daniel Glenfield
> > >Date: Wednesday, 15 January 2003 5:59:53 PM
> > >To: dev...@li...
> > >Subject: [Dev-C++] Lookup tables, with bsearch, lsearch, qsort etc.
> > >
> > >I'm trying to understand lookup tables and the bsearch, lsearch, qsort
> > >functions. I'm trying to create a structure with an integer and a text
> > >string, and I want to look up the number and get the text associated
>with
> > >it. for example, at the moment I have
> > >
> > >// BIG switch here
> > >switch (PaperSize) // can be 1 - 41
> > >{
> > >case 1: ListBox = "Paper Type: Letter";
> > >Listbox->AddString(ListBoxChoice);
> > >break;
> > >
> > >case 2: //... the same again
> > >//...
> > >case 41: // same again
> > >
> > >
> > >I'm trying to replace this with a lookup table but I'm finding it
>difficult
> > >- examples on the net about bsearch are not quite what I need.
> > >
> > >
> > >-------------------------------------------------------
> > >This SF.NET email is sponsored by: Take your first step towards giving
> > >your online business a competitive advantage. Test-drive a Thawte SSL
> > >certificate - our easy online guide will show you how. Click here to
>get
> > >started: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0027en
> > >_______________________________________________
> > >Dev-cpp-users mailing list
> > >Dev...@li...
> > >TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
> > >https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> >
> >
> > _________________________________________________________________
> > Help STOP SPAM: Try the new MSN 8 and get 2 months FREE*
> > http://join.msn.com/?page=features/junkmail
> >
> >
> >
> > -------------------------------------------------------
> > This SF.NET email is sponsored by: A Thawte Code Signing Certificate
> > is essential in establishing user confidence by providing assurance of
> > authenticity and code integrity. Download our Free Code Signing guide:
> > http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0028en
> > _______________________________________________
> > Dev-cpp-users mailing list
> > Dev...@li...
> > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
> > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> >
>
>
>
>-------------------------------------------------------
>This SF.NET email is sponsored by: A Thawte Code Signing Certificate
>is essential in establishing user confidence by providing assurance of
>authenticity and code integrity. Download our Free Code Signing guide:
>http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0028en
>_______________________________________________
>Dev-cpp-users mailing list
>Dev...@li...
>TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
>https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail
|