关键词法模糊查找
clear
@5,4 say“关键词的说明:”
@row(),col() say“关键词在试题中可由用户任意选取而输入,输第一”
@row(),col() say“个、第二个关键词随便,关键词长度不限,一般选取2-4”
@row(),col() say“个汉字、字母、或组合。关键词前,汉字间避免空格。”
store " " to key1
@3,10 say“输入第一个关键词:”get key1
do 1-2
read
key1=trim(key1)
Store " " to key2
@4,10 say“输入第二个关键词:”get key2
read
key2=trim(key2)
do I-3
use <数据库文件名>
go top
ss="Y"
do while .not. eof()
f1=at(KEY1,试题内容)
f2=at(key2,试题内容)
*试题内容为库的字段变量名
if f1=0 .and. f2=0
* AND 与 OR
skip
else
@3,0 CLEAR
display off
@1,10 say“需要继续查找吗(Y/N)?”get ss
do 1-3
read
if ss="N"
exit
else
skip
endif
endif
enddo
说明:①定义KEY1、KEY2为八个字符长的空变量;
②AND.OR运算据实际需要而选择,一般“OR”。
附:
* 1-2.prg
set talk off
set esca off
poke 1047,0
poke 1050,30
poke 1050,32
poke 1054,0
poke 1055,106
* 1-3.prg
set talk off
set esca off
poke 1047,64
poke 1050,30
poke 1052,32
poke 1054,0
poke 1055,109