![]() |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
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 |
![]() |
| Thread Tools | |
| Display Modes | |
|
|