求解问题(一)?
字段名 类型性别 字符
月龄 字符
体重 字符
评价 字符
根据表:性别:女
月龄 体重
低体重 正常 超重 肥胖
1月 6 10 16 19 22
2月 10 16 19 22 26
例如:1个为2个月的女孩,体重是17,请问如何得到评价为正常?
2014-05-08 06:30
2014-05-08 07:11
2014-05-08 07:12
2014-05-08 08:03
程序代码:close all
use 体重标准表 alias t1 in 0
select 0
use 体测结果表 alias t2
scan
cMont = allt(月龄)
nWeight = val(体重)
select t1
locate for allt(月龄)==cMont
if found()
do case
case nWeight <= val(低体重)
cRet = '低体重'
case nWeight <= val(正常)
cRet = '正常'
case nWeight <= val(超重)
cRet = '超重'
otherwise
cRet = '肥胖'
endcase
replace 评价 with cRet in t2
endif
endscan
go top
browse

2014-05-08 09:15
2014-05-09 06:46
程序代码:lose all
use 体重标准表 alias t1 in 0
select 0
use 体测结果表 alias t2
scan
cMont = allt(月龄)
nWeight = val(体重)
*-----------------------------------
cSex = allt(性别)
select t1
locate for allt(月龄)==cMont and allt(性别)==cSex
*-----------------------------------
if found()
do case
case nWeight <= val(低体重)
cRet = '低体重'
case nWeight <= val(正常)
cRet = '正常'
case nWeight <= val(超重)
cRet = '超重'
otherwise
cRet = '肥胖'
endcase
replace 评价 with cRet in t2
endif
endscan
go top
browse
2014-05-09 08:29