求几个VFP的编程代码!

来源:百度知道 编辑:UC知道 时间:2024/05/31 11:08:17
1、编一程序,在表xscj.dbf(表结构为:姓名 C(8)、数学 N(3)、语文 N(3)、外语 N(3)、总分 N(3)、平均分 N(4,1)、等级 C(4))中,根据数学、语文、外语成绩,计算每个学生的总分和平均分,并填写等级:平均分在90分以上(含90分)为优秀, 80分以上(含80 分)为良好,70分以上(含70分)为中等,60分以上(含60分)为及格,否则为不及格。

2、设有数据库xs.dbf(学号 C(8),姓名 C(8),入学成分 N(3)),编程求出入学总分最高的同学。

1的回答:(说明:等级 应为 C(6))
use xscj
do while .not. eof()
repl 总分 with 数学+语文+外语,平均分 with (数学+语文+外语)/3
do case
case 平均分>=90
repl 等级 with "优秀"
case 平均分<90 .and. 平均分>=80
repl 等级 with "良好"
case 平均分<80 .and. 平均分>=70
repl 等级 with "中等"
case 平均分<70 .and. 平均分>=60
repl 等级 with "及格"
case 平均分<60
repl 等级 with "不及格"
endcase
skip
enddo

2的回答:
use xs
high_one=0
do while .not. eof()
if 入学总分>high_one
high_one=入学总分
one_姓名=姓名
one_学号=学号
endif
skip
enddo
? one_学号,one_姓名,high_one