1.此程序欲将js表中所有党员的年龄加
2.
clear
use 教师
copy to js
use js
loca for not 党员否&&此处应该为loca for 党员否
do while .not. eof()
replace 年龄with 年龄+2
skip &&此处应该为continue
enddo
use
2.功能是:计算100以内的偶数和。
请改错
Clear
S=1 &&此处应该为s=0
For i=1 to 100 step 2 &&此处应该为For i=2 to 100 step 2 S=s+i
Endfor
?”2+4+6……+98=”+str(s)
3.任意输入一个数计算这个数的阶层。
Clear
Input “请输入一个数:” to n
S=0 &&此处应该为s=1
For i=1 to n
S=s+I &&此处应该为s=s*i
Endfor
?”n!=”+str(s)
4.统计教师表中男女学生的人数。
Clear
Use 教师
Store 1 to man,woman &&此处应为store 0 to man,woman Do while not bof() &&此处应为do while not eof()
If 性别=”男”
Man=man+1
Else
Womam=woman+1
Endif
skip
Enddo
5.假设10个数已存放在数组s中,下面程序段用于将此10个数由大
到小排序,请改正错误.
I=1
Do while i<=9
J=j+1 &&此处应为j=i+1
Do while j<=9
If s(i)>s(j) &&此处应为s(i)<s(j)
W=s(i)
S(i)=s(j)
S(j)=w
Endif
J=j+1
Enddo
I=i+1
Enddo
6.显示业务信息表中的前10条记录的学生专业,人数,但园艺专业
的除外.
Clear
Use 业务信息表
do while not eof()
if 学生专业=”园艺”
skip
exit &&此处应为loop
endif
list field 学生专业,人数&&此处应该为disp field 学生专业,人数
skip
enddo
7.按记录号逻辑删除记录
set talk off
use 教师
accept “要删除的记录号:” to nn &&此处应为input “要删除的记录号:” to nn
skip nn &&此处应为go nn
disp
wait [是否逻辑删除此记录(Y/N)?] to p
if upper(p)=”Y”
pack &&此处应为dele
endif
use
set talk on
统计教师表中所有教师的平均年龄,并将统计结果追加在表尾。
Clear
Set talk off
Use 教师
Sum to NL
Append &&此处应为append blank Replace all 姓名with “均年龄” , 年龄with NL
*上一行应为Replace 姓名with “均年龄” ,年龄with NL replace Use。