1.
CLEAR
INPUT "请输入N的值:" TO N
S=0
T=1
DO WHILE T<=N
S=S+T
T=T+1
ENDDO
?"1+2+3+……+N",S
2.
CLEAR
CLEAR ALL
SET SAFE OFF
SET TALK OFF
SELECT 1
USE XS
INDEX ON 学号 TAG XH
SELECT 2
USE KC
INDEX ON 课程号 TAG KCH
SELECT 3
USE CJ
SET RELATION TO 学号 INTO XS
SET RELATION TO 课程号 INTO KC ADDITIVE
ACCEPT "输入课程号:" TO KCH
LOCATE FOR 课程号=KCH
?"选修的课程号:"+KCH+" 课程号"+KC.课程名
?"学生姓名 成绩"
DO WHILE NOT EOF()
?XS.姓名,考试成绩
CONTINUE
ENDDO
CALCULATE AVG(考试成绩),MAX(考试成绩),MIN(考试成绩) TO PJF,ZGF,ZDF FOR 课程号=KCH
?"平均分:",STR(PJF,5,1),"最高分:",STR(ZGF,5,1),"最低分:",STR(ZDF,5,1)
CLOSE ALL
SET TALK ON
SET SAFE ON
RETURN