Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 06-24-2002, 05:35 AM
3homer
Guest
 
Posts: n/a
Default Quiz about data store??

i have a text file ,which stored alot of questions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1.xxxxxxxxxxxxxxxx,HGHGHHFGH

A.DDDD
B.EEEE
C.3333
D.GGGG
E.6666

ANSWER:C
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
the first block is question title,then the chooses,the last block is answers,

i want store them in my own file format,not in *.dbf,*.db or *.mdb,but still i want query function,

what or how store structure should i use ? how to store them?


~3homer~
Thanx,very much.
Reply With Quote
  #2  
Old 06-24-2002, 06:27 AM
GoodFun GoodFun is offline
Senior Member
 
Join Date: Jan 2001
Posts: 2,645
Default RE: Quiz about data store??

you could write a class that looks something like this:

type TQuestions = class
Question: String;
Answers: Array[0..4] of String;
Answer: Integer;
end;

of course you would write it a bit more elaborate, i.e. with private data members which then have public properties and so on.

You also create a list class derived from TObjectList in which you put the search functions that you need...
You can also put a procedure to read the text file and fill the objects in the object list into that list class...

I suggest you read the help file on TObjectList to see what it does and if you're not familiar yet with Object Oriented Programming, then I suggest you read chapter 7 Classes and Objects from the Object Pascal Language Guide. If you don't have the printed version of it, look for a file called oplg.pdf on your Delphi CD or download it from here:
http://www.borland.com/techpubs/delphi/

Hope this helps,

Marcel

Please click on Accept if this helped...
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 07:46 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.