[教育学]二级VFP上机答案_第1页
[教育学]二级VFP上机答案_第2页
[教育学]二级VFP上机答案_第3页
[教育学]二级VFP上机答案_第4页
[教育学]二级VFP上机答案_第5页
已阅读5页,还剩205页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、单击此处编辑母版标题样式单击此处编辑母版文本样式第二级第三级第四级第五级*二级上机考试30 34第34次上机考试1号区2号区34.1.2编写程序文件名:abc1.PRGselect 2use chengjiselect 1use xuesheng翻开表数据处理统计,修改do while !eof() select 2 average 成绩 to pj for 学号=a.学号 select 1 replace 平均分 with pj skipenddo1.根据chengji.dbf表中学生选课成绩,计算每个学生的平均分,并将之填充到xuesheng.dbf表中相应记录的平均分字段;数据显示2.输

2、出填充了平均分的xuesheng.dbf表中数据,输出格式如下:list off关闭表close tablesclearset talk offset safety offselect 2use chengjiselect 1use xueshengdo while !eof() select 2 average 成绩 to pj for 学号=a.学号 select 1 replace 平均分 with pj skipenddolist offclose tablesabc1.PRG34.1.3表单设计文件名:form1.SCX创立表单,添加控件、数据环境设置控件属性thisform属性值t

3、hisform.Caption学生成绩查询thisform.AutoCenter.T.thisform子控件属性值thisform.Label1.Caption请输入姓名thisform.lbl学号.Caption学号thisform.lbl姓名.Caption姓名thisform.lbl课程号.Caption课程号thisform.lbl成绩.Caption成绩thisform.txt学号.ControlSourcechengji.学号thisform.txt姓名.ControlSourcexuesheng.姓名thisform.txt课程号.ControlSourcechengji.课程号

4、thisform.txt成绩.ControlSourcechengji.成绩thisform.Command1.Caption查询thisform.Command2.Caption结束编写事件代码thisform.Command1.Click事件locate for xuesheng.姓名=alltrim(thisform.text1.value)thisform.Refreshthisform.Command2.Click事件thisform.Releasethisform.Init事件select chengji34.2.2编写程序文件名:abc2.PRGselect 1use zg翻开表

5、数据处理1修改replace all 工资总额 with 根本工资*1.05+奖金1.每人根本工资上调5%后计算其工资总额;数据处理2查询,显示2.输入职工号进行查找,如果找到,那么显示其姓名,根本工资,奖金,工资总额,否那么显示“无此人信息!。界面如下图:accept 请输入要查找的职工号: to zghlocate for 职工号=zghif found() ? *查询结果* ? 职工号:, zgh ? 姓名 根本工资 奖金 工资总额 ? 姓名, 根本工资, 奖金, 工资总额else ? 无此人信息!endif关闭表close tablesclearset talk offset safe

6、ty offselect 1use zgreplace all 工资总额 with 根本工资*1.05+奖金accept 请输入要查找的职工号: to zghlocate for 职工号=zghif found() ? *查询结果* ? 职工号:, zgh ? 姓名 根本工资 奖金 工资总额 ? 姓名, 根本工资, 奖金, 工资总额else ? 无此人信息!endifclose tablesabc2.PRG34.2.3表单设计文件名:form2.SCX创立表单,添加控件、数据环境设置控件属性thisform属性值thisform.Caption职工工资浏览thisform.Label1属性值t

7、hisform.Label1.Caption职工工资thisform.Label1.FontName楷体_GB2312thisform.Label1.FontSize16thisform.Label1.FontBold.T.thisform.Label1.BackStyle0thisform子控件属性值thisform.lbl姓名.Caption姓名thisform.lbl姓名. FontName楷体_GB2312thisform.lbl职工号.Caption职工号thisform.lbl职工号. FontName楷体_GB2312thisform.lbl基本工资.Caption基本工资thi

8、sform.lbl基本工资. FontName楷体_GB2312thisform.lbl奖金.Caption奖金thisform.lbl奖金. FontName楷体_GB2312thisform.lbl工资总额.Caption工资总额thisform.lbl工资总额. FontName楷体_GB2312thisform子控件属性值thisform.txt姓名.ControlSourcezg.姓名thisform.txt职工号.ControlSourcezg.职工号thisform.txt基本工资.ControlSourcezg.基本工资thisform.txt奖金.ControlSourcez

9、g.奖金thisform.txt工资总额.ControlSourcezg.工资总额thisform.Command1.Caption上一条thisform.Command2.Caption下一条thisform.Command3.Caption退出编写事件代码thisform.Command1.Click事件skip -1if bof() go topendifthisform.Refreshthisform.Command2.Click事件skipif eof() go bottomendifthisform.Refreshthisform.Command3.Click事件thisform.

10、Release子表:1号区父表:2号区34.3.2编写程序文件名:abc3.PRGselect 1use 成绩index on 学号 tag xhreplace all 平均分 with (英语+计算机)/2select 2use 学生set relation to 学号 into a翻开表,索引,关联,修改1.利用成绩.dbf的英语和计算机成绩计算平均分。数据处理1显示2.显示如下信息。list fields 学号, 姓名, a.英语, a.计算机, a.平均分数据处理2查询,显示3.从键盘输入学号,查询该学生的如下信息。要求程序能屡次查询,按Q键退出查询。如果找不到该学生,显示“查无此人!

11、。do while .T. accept 请输入学号: to xh if upper(xh)=Q exit endif locate for 学号=xh if found() ? 学号 姓名 系别 英语 计算机 平均分 ? 学号, 姓名, 系号, a.英语, a.计算机, a.平均分 else ? 查无此人! endifenddo关闭表close tablesclearset talk offset safety offselect 1use 成绩index on 学号 tag xhreplace all 平均分 with (英语+计算机)/2select 2use 学生set relatio

12、n to 学号 into alist fields 学号, 姓名, a.英语, a.计算机, a.平均分do while .T. accept 请输入学号: to xh if upper(xh)=Q exit endif locate for 学号=xh if found() ? 学号 姓名 系别 英语 计算机 平均分 ? 学号, 姓名, 系号, a.英语, a.计算机, a.平均分 else ? 查无此人! endifenddoclose tablesabc3.PRG34.3.3菜单设计文件名:menu3.MNX创立菜单设置菜单“快捷菜单”菜单结果快捷键撤消(U)菜单项#_med_undoC

13、TRL+Z粘贴(P)菜单项#_med_pasteCTRL+V复制(C)菜单项#_med_copyCTRL+C剪切(T)菜单项#_med_cutCTRL+X生成菜单程序编写菜单调用程序代码menu3.prgpush key clearon key label rightmouse do menu3.mpr子表:2号区父表:1号区34.4.2编写程序文件名:abc4.PRGselect 2use 分类index on 分类编码 tag bmselect 1use 商品set relation to 分类编码 into b翻开表,索引,关联数据处理查询,显示1.通过“分类编码来查询“商品名称,“分类

14、名称、“进货日期与“进货价格等信息。 2.查询信息输出界面如下所示:accept 请输入查询商品的分类编码: to bmlocate for 分类编码=bm? *查询结果*? 商品名称 分类名称 进货日期 进货价格? *do while found() ? 商品名称, b.分类名称, 进货日期, 进货价格 continueenddo关闭表close tablesclearset talk offset safety offselect 2use 分类index on 分类编码 tag bmselect 1use 商品set relation to 分类编码 into baccept 请输入查询

15、商品的分类编码: to bmlocate for 分类编码=bm? *查询结果*? 商品名称 分类名称 进货日期 进货价格? *do while found() ? 商品名称, b.分类名称, 进货日期, 进货价格 continueenddoclose tablesabc4.PRG34.4.3表单设计文件名:form4.SCX创立表单,添加控件、数据环境设置控件属性thisform属性值thisform.Caption商品浏览thisform.Optiongroup1属性值thisform.Optiongroup1.ButtonCount4thisform.Optiongroup1.Optio

16、n1.Caption饮料thisform.Optiongroup1.Option2.Caption调味品thisform.Optiongroup1.Option3.Caption酒类thisform.Optiongroup1.Option4.Caption小家电thisform子控件属性值thisform.Command1.Caption退出thisform.Command2.Caption确定编写事件代码thisform.Command2.Click事件do case case thisform.optiongroup1.value=1 SELECT * FROM 商品 WHERE 分类编码

17、= 1001 case thisform.optiongroup1.value=2 SELECT * FROM 商品 WHERE 分类编码= 2001 case thisform.optiongroup1.value=3 SELECT * FROM 商品 WHERE 分类编码= 3001 case thisform.optiongroup1.value=4 SELECT * FROM 商品 WHERE 分类编码= 4001endcasethisform.Command1.Click事件thisform.Release父表:1号区子表:2号区34.5.2编写程序文件名:abc5.PRGselec

18、t 2use daodaindex on 票号 tag phselect 1use fahuoset relation to 票号 into b翻开表,索引,关联数据处理1修改replace all 货运费 with b.里程km*b.重量kg*0.151.利用daoda.dbf中的“重量和“里程计算fahuo.dbf中的“货运费。货运费=里程*重量*0.15数据处理2查询,显示2.从键盘输入票号,查询该票号的信息。要求能屡次查询,如果找不到票号信息,提示“查无此票号!信息。do while .T. accept 请输入查询票号: to ph if upper(ph)=Q exit endif

19、 locate for 票号=ph if found() ? *查询票号信息* ? 票号 货物名 发货日期 到达日期 货运费元 ? - ? 票号, b.货物名, 发货日期, b.到达日期, 货运费 else ? 查无此票号! endifenddo关闭表close tablesclearset talk offset safety offselect 2use daodaindex on 票号 tag phselect 1use fahuoset relation to 票号 into breplace all 货运费 with b.里程km*b.重量kg*0.15do while .T. ac

20、cept 请输入查询票号: to ph if upper(ph)=Q exit endif locate for 票号=ph if found() ? *查询票号信息* ? 票号 货物名 发货日期 到达日期 货运费元 ? - ? 票号, b.货物名, 发货日期, b.到达日期, 货运费 else ? 查无此票号! endifenddoclose tablesabc5.PRG34.5.3表单设计文件名:form5.SCX创立表单,添加控件、数据环境设置控件属性thisform属性值thisform.Caption查询thisform.Combo1属性值thisform.Combo1.RowSou

21、rceType6thisform.Combo1.RowSourcefahuo.票号thisform子控件属性值thisform.Label1.Caption选择票号thisform.Command1.Caption退出编写事件代码thisform.Command1.Click事件thisform.Releasethisform.Combo1.Click事件SELECT Fahuo.票号, Daoda.货物名, Fahuo.发货车站, Fahuo.货运费; FROM fahuo INNER JOIN daoda ; ON Fahuo.票号 = Daoda.票号; WHERE Fahuo.票号 =

22、 bo1.value; INTO CURSOR tmpthisform.grid1.Recordsource=tmp34.5.3表单设计文件名:form5.SCX创立数据库、视图创立表单,添加控件、数据环境设置控件属性thisform属性值thisform.Caption查询thisform.Combo1属性值thisform.Combo1.RowSourceType6thisform.Combo1.RowSourcefahuo.票号thisform子控件属性值thisform.Label1.Caption选择票号thisform.Command1.Caption退出Thisform.grd视

23、图1属性值Thisform.grd视图1.RecordSource视图1Thisform.grd视图1.ColumnCount4Thisform.grd视图1.Column1.ControlSource视图1.票号Thisform.grd视图1.Column1.Header1.Caption票号Thisform.grd视图1.Column2.ControlSource视图1.货物名Thisform.grd视图1.Column2.Header1.Caption货物名Thisform.grd视图1.Column3.ControlSource视图1.发货车站Thisform.grd视图1.Colum

24、n3.Header1.Caption发货车站Thisform.grd视图1.Column4.ControlSource视图1.货运费Thisform.grd视图1.Column4.Header1.Caption货运费编写事件代码thisform.Command1.Click事件thisform.Releasethisform.Combo1.Click事件set filter to 视图1.票号=bo1.valuethisform.refresh1号区2号区34.6.2编写程序文件名:abc6.PRGselect 2use stock_csselect 1use stock_mmindex on

25、 股票代码 tag gpdm翻开表,索引数据处理修改,显示为空表,只有结构;根据stock_mm.dbf种数据,填写stock_cs.dbf,注:买卖标记为.T.表示买入,.F.表示卖出。2.输出stock_cs.dbf表填充后的情况,输出格式如下:do while !eof() if 买卖标记 if 股票代码=b.股票代码 replace b.买入次数 with b.买入次数+1, b.最高价 with max(单价, b.最高价) else append blank in 2 replace b.股票代码 with 股票代码, b.买入次数 with 1, b.最高价 with 单价 en

26、dif endif skipenddoselect 2list off关闭表close tablesclearset talk offset safety offselect 2use stock_csselect 1use stock_mmindex on 股票代码 tag gpdmdo while !eof() if 买卖标记 if 股票代码=b.股票代码 replace b.买入次数 with b.买入次数+1, b.最高价 with max(单价, b.最高价) else append blank in 2 replace b.股票代码 with 股票代码, b.买入次数 with 1

27、, b.最高价 with 单价 endif endif skipenddoselect 2list offclose tablesabc6.PRG34.6.2编写程序文件名:abc6.PRG翻开表,数据处理为空表,只有结构;根据stock_mm.dbf种数据,填写stock_cs.dbf,注:买卖标记为.T.表示买入,.F.表示卖出。2.输出stock_cs.dbf表填充后的情况,输出格式如下:SELECT Stock_mm.股票代码, count(*) as 买入次数,; max(Stock_mm.单价) as 最高价; FROM stock_mm; WHERE Stock_mm.买卖标记;

28、 GROUP BY Stock_mm.股票代码; INTO TABLE stock_cs.dbfselect stock_cslist off关闭表close tablesclearset talk offset safety offSELECT Stock_mm.股票代码, count(*) as 买入次数,; max(Stock_mm.单价) as 最高价; FROM stock_mm; WHERE Stock_mm.买卖标记; GROUP BY Stock_mm.股票代码; INTO TABLE stock_cs.dbfselect stock_cslist offclose table

29、sabc6.PRG34.6.3表单设计文件名:form6.SCX创立菜单“快捷菜单”菜单结果股票浏览命令股票交易查询命令退出命令生成菜单程序创立表单,添加控件、数据环境设置控件属性thisform属性值thisform.Caption股票查询thisform.AutoCenter.T.thisform子控件属性值thisform.Command1.Caption退出thisform.Label1属性值thisform.Label1.Caption股票查询系统thisform.Label1.FontName楷体_GB2312thisform.Label1.FontSize16编写事件代码this

30、form.Label1.RightClick事件do menu6.mprthisform.Command1.Click事件thisform.Release第33次上机考试子表:2号区父表:1号区33.1.2编写程序文件名:abc1.PRGselect 2use 学生index on 学号 tag xhselect 1use 成绩set relation to 学号 into b翻开表,索引,关联数据处理1修改replace all 成绩 with 成绩*1.15 for 课程名=Access程序设计将课程为“Access程序设计“的成绩提高15%。数据处理2查询,显示通过输入“学号查询学生的信

31、息,即:学号、姓名、课程名、成绩、学院等资料。假设没找到,显示“数据表中没有查到此人信息!。界面舅图所示:accept 请输入查询的学号: to xhlocate for 学号=xhif found() ? *查询结果* ? 学号 姓名 课程名 成绩 学院 do while found() ? 学号, b.姓名, 课程名, 成绩, b.学院 continue enddo ? *else ? 数据表中没有查到此人信息!endif关闭表close tablesclearset talk offset safety offselect 2use 学生Index on 学号 tag xhselect

32、1use 成绩set relation to 学号 into breplace all 成绩 with 成绩*1.15 for 课程名=Access程序设计accept 请输入查询的学号: to xhlocate for 学号=xhif found() ? *查询结果* ? 学号 姓名 课程名 成绩 学院 do while found() ? 学号, b.姓名, 课程名, 成绩, b.学院 continue enddo ? *else ? 数据表中没有查到此人信息!endifclose tablesabc1.PRG33.1.3表单设计文件名:form1.SCX创立表单,添加控件、数据环境thi

33、sform.Optiongroup1属性值thisform.Optiongroup1.Value0thisform.Optiongroup1.ButtonCount2thisform.Optiongroup1.Option1.Caption男thisform.Optiongroup1.Option2.Caption女设置控件属性thisform.Command1属性值thisform.Command1.Caption结束thisform.Grid1属性值thisform.Grid1.Visible.F.编写事件代码thisform.Optiongroup1.Click事件xb=do case

34、case this.value=1 xb=男 case this.value=2 xb=女endcaseSELECT * FROM 学生; WHERE 学生.性别 = xb; INTO CURSOR tmpthisform.Grid1.Recordsource=tmpthisform.Grid1.Visible=.T.thisform.Command1.Click事件thisform.Release33.1.3表单设计文件名:form1.SCX创立表单,添加控件、数据环境thisform.Optiongroup1属性值thisform.Optiongroup1.Value0thisform.O

35、ptiongroup1.ButtonCount2thisform.Optiongroup1.Option1.Caption男thisform.Optiongroup1.Option2.Caption女设置控件属性thisform.Command1属性值thisform.Command1.Caption结束thisform.grd学生属性值thisform.grd学生.Visible.F.thisform.grd学生.Recordsource学生编写事件代码thisform.Optiongroup1.Click事件do case case this.value=1 set filter to 性

36、别=男 case this.value=2 set filter to 性别=女endcasethisform.grd学生.Visible=.T.thisform.refreshthisform.Command1.Click事件thisform.Release子表:2号区父表:1号区33.2.2编写程序文件名:abc2.PRGselect 2use yyuindex on 学号 tag xhreplace all 平均分 with (笔试+听力)/2select 1use kshset relation to 学号 into b翻开表,索引,关联,修改计算并填写“yyu.dbf的平均;数据处理

37、修改,显示填写ksh.dbf中的“评语字段值。其中:当平均分=90,评语为“优; 当平均分=80,评语为“良; 当平均分=70,评语为“中。查询输入格式如下:do while !eof() do case case b.平均分=90 replace 评语 with 优 case b.平均分=80 replace 评语 with 良 case b.平均分=70 replace 评语 with 中 endcase skipenddobrowse fields 学号, 姓名, b.笔试, b.听力, b.平均分, 评语关闭表close tablesclearset talk offset safet

38、y offselect 2use yyuindex on 学号 tag xhreplace all 平均分 with (笔试+听力)/2select 1use kshset relation to 学号 into bdo while !eof() do case case b.平均分=90 replace 评语 with 优 case b.平均分=80 replace 评语 with 良 case b.平均分=70 replace 评语 with 中 endcase skipenddobrowse fields 学号, 姓名, b.笔试, b.听力, b.平均分, 评语close tables

39、abc2.PRG33.2.3表单设计文件名:form2.SCX创立表单,添加控件、数据环境thisform.Pageframe1属性值thisform.Pageframe1.PageCount2thisform.Pageframe1.Page1.Caption成绩thisform.Pageframe1.Page2.Caption综合设置控件属性thisform.Command1属性值thisform.Command1.Caption退出thisform属性值thisform.Caption英语成绩thisform.Pageframe1.Page2子控件属性值thisform.Pageframe

40、1.Page2.lbl学号.Caption学号thisform.Pageframe1.Page2.lbl平均分.Caption平均分thisform.Pageframe1.Page2.lbl评语.Caption评语thisform.Pageframe1.Page2.txt学号.ControlSourceyyu.学号thisform.Pageframe1.Page2.txt平均分.ControlSourceyyu.平均分thisform.Pageframe1.Page2.txt评语.ControlSourceksh.评语thisform.Pageframe1.Page2.Commandgroup

41、1.ButtonCount3thisform.Pageframe1.Page2.Commandgroup1.Command1.Caption上一条thisform.Pageframe1.Page2.Commandgroup1.Command2.Caption下一条thisform.Pageframe1.Page2.Commandgroup1.Command3.Caption结束编写事件代码thisform.Init事件SELECT Yyu.学号, Ksh.姓名, Yyu.笔试, Yyu.听力; FROM yyu INNER JOIN ksh; ON Yyu.学号 = Ksh.学号; INTO

42、CURSOR tmpthisform.Pageframe1.Page1.Grid1.Recordsource=tmpselect yyuthisform.Command1.Click事件thisform.Releasethisform.Pageframe1.Page2.Commandgroup1.Click事件do case case this.value=1 if !bof() skip -1 endif case this.value=2 if !eof() skip endif case this.value=3 thisform.Releaseendcasethisform.Refre

43、sh33.2.3表单设计文件名:form2.SCX创立数据库、视图创立表单,添加控件、数据环境thisform.Pageframe1属性值thisform.Pageframe1.PageCount2thisform.Pageframe1.Page1.Caption成绩thisform.Pageframe1.Page2.Caption综合设置控件属性thisform属性值thisform.Caption英语成绩thisform.Command1属性值thisform.Command1.Caption退出thisform.Pageframe1.Page1子控件属性值thisform.Pagefra

44、me1.Page1.grd视图1.Recordsource视图1thisform.Pageframe1.Page2子控件属性值thisform.Pageframe1.Page2.lbl学号.Caption学号thisform.Pageframe1.Page2.lbl平均分.Caption平均分thisform.Pageframe1.Page2.lbl评语.Caption评语thisform.Pageframe1.Page2.txt学号.ControlSourceyyu.学号thisform.Pageframe1.Page2.txt平均分.ControlSourceyyu.平均分thisform

45、.Pageframe1.Page2.txt评语.ControlSourceksh.评语thisform.Pageframe1.Page2.Commandgroup1.ButtonCount3thisform.Pageframe1.Page2.Commandgroup1.Command1.Caption上一条thisform.Pageframe1.Page2.Commandgroup1.Command2.Caption下一条thisform.Pageframe1.Page2.Commandgroup1.Command3.Caption结束编写事件代码thisform.Init事件select y

46、yuthisform.Command1.Click事件thisform.Releasethisform.Pageframe1.Page2.Commandgroup1.Click事件do case case this.value=1 if !bof() skip -1 endif case this.value=2 if !eof() skip endif case this.value=3 thisform.Releaseendcasethisform.Refresh子表:2号区父表:1号区33.3.2编写程序文件名:abc3.PRGselect 2use 商品index on 商品号 tag

47、 sphselect 1use 订单set relation to 商品号 into b翻开表,索引,关联数据处理1修改replace all 总金额 with b.单价*数量计算订单的总金额总金额=单价*数量,填入“订单.dbf的“总金额字段中。数据处理2修改,显示按订单号查询该商品名、单价、数量和总金额。要求能反复查询。直到用户不再查询为止。界面如以下图所示:请输入订单号:0002=查询结果=商品名称 单价 数量 总金额计算机操作系统 31.00 2 62.00继续查询吗?y/nndo while .T. accept 请输入订单号: to ddh locate for 订单号=ddh ?

48、 =查询结果= ? 商品名称 单价 数量 总金额 do while found() ? b.商品名, b.单价, 数量, 总金额 continue enddo wait 继续查询吗Y/N? to yn if upper(yn)=N exit endifenddo关闭表close tablesclearset talk offset safety offselect 2use 商品index on 商品号 tag sphselect 1use 订单set relation to 商品号 into breplace all 总金额 with b.单价*数量do while .T. accept 请

49、输入订单号: to ddh locate for 订单号=ddh ? =查询结果= ? 商品名称 单价 数量 总金额 do while found() ? b.商品名, b.单价, 数量, 总金额 continue enddo wait 继续查询吗Y/N? to yn if upper(yn)=N exit endifenddoclose tablesabc3.PRG33.3.3菜单设计文件名:menu3.MNX创立菜单设置菜单菜单栏结果查询子菜单退出(=3 mand1.enabled=.F.endifthisform.Command2.Click事件thisform.Release33.5.

50、2编写程序文件名:abc5.PRGuse cj5翻开表数据处理 统计,显示1. 从键盘上输入查询的学号,能查询该同学的学号、平均成绩2. 程序要求能反复查询输出,其输出格式如下:。do while .T. accept 请输入查询的学号: to xh average 成绩 to pj for 学号=xh ? 学号:, xh, 平均成绩:, pj wait 继续查询吗Y/N? to yn if upper(yn)=N exit endifenddo关闭表close tablesclearset talk offset safety offuse cj5do while .T. accept 请输

51、入查询的学号: to xh average 成绩 to pj for 学号=xh ? 学号:, xh, 平均成绩:, pj wait 继续查询吗Y/N? to yn if upper(yn)=N exit endifenddoclose tablesabc5.PRG33.5.3表单设计文件名:form5.SCX创立表单,添加控件、数据环境thisform.OPtiongroup1属性值thisform.OPtiongroup1.ButtonCount2thisform.OPtiongroup1.OPtion1.Caption学号thisform.OPtiongroup1.OPtion2.Cap

52、tion课程号设置控件属性thisform子控件属性值thisform.Label1.Caption请选择:thisform.Label2.Caption请输入thisform.lbl学号.Caption学号thisform.lbl课程号.Caption课程号thisform.lbl成绩.Caption成绩thisform.txt学号.ControlSourcecj5.学号thisform.txt课程号.ControlSourcecj5.课程号thisform.txt成绩.ControlSourcecj5.成绩thisform.Command1.Caption查询thisform.Comman

53、d2.Caption继续thisform.Command3.Caption结束编写事件代码thisform.Command1.Click事件do case case thisform.Optiongroup1.value=1 locate for cj5.学号=alltrim(thisform.text1.value) case thisform.Optiongroup1.value=2 locate for cj5.课程号=alltrim(thisform.text1.value)endcasethisform.Refreshthisform.Command3.Click事件thisform

54、.Releasethisform.Command2.Click事件if !found() returnendifcontinuethisform.Refresh第32次上机考试32.1.2编写程序文件名:abc1.PRGuse 成绩翻开表数据处理1修改replace all 总成绩 with 平时成绩*0.2+考试成绩*0.8以平时成绩20%、考试成绩80%的比例填入总成绩;数据处理2修改确定等级并填入等级字段。等级评定方法是:90分以上为优,75-89为良,60-74为及格,60分以下为不及格;如下图:go topdo while !eof() do case case 总成绩=90 rep

55、lace 等级 with 优 case 总成绩=75 replace 等级 with 良 case 总成绩=60 replace 等级 with 及格 otherwise replace 等级 with 不及格 endcase skipenddobrowse关闭表close tablesclearset talk offset safety offuse 成绩replace all 总成绩 with 平时成绩*0.2+考试成绩*0.8go topdo while !eof() do case case 总成绩=90 replace 等级 with 优 case 总成绩=75 replace 等

56、级 with 良 case 总成绩=60 replace 等级 with 及格 otherwise replace 等级 with 不及格 endcase skipenddobrowseclose tablesabc1.PRG32.1.3表单设计文件名:form2.SCX创立表单,添加控件、数据环境设置控件属性thisform子控件属性值thisform.Label1.Caption学号thisform.lbl课程号.Caption课程号thisform.lbl考试成绩.Caption考试成绩thisform.lbl平时成绩.Caption平时成绩thisform.txt课程号.Control

57、Source成绩.课程号thisform.txt考试成绩.ControlSource成绩.考试成绩thisform.txt平时成绩.ControlSource成绩.平时成绩thisform.Command1.Caption查询thisform.Command2.Caption继续thisform.Command3.Caption退出编写事件代码thisform.Command1.Click事件locate for 成绩.学号=alltrim(thisform.text1.value)if !found() messagebox(没有查找人的数据, 48, 出错信息)endifthisform.

58、Refreshthisform.Command3.Click事件thisform.Releasethisform.Command2.Click事件if !found() returnendifcontinueif !found() messagebox(已无查找人员信息, 48, 结束信息)endifthisform.Refresh子表:2号区父表:1号区32.2.2编写程序文件名:abc2.PRGselect 2use cjindex on 学号 tag xhselect 1use xsset relation to 学号 into b翻开表,索引,关联数据处理1修改replace all

59、平均 with (b.数学+ b.英语+ b.计算机)/3计算表“CJ.DBF中数学、英语和计算机三科的平均成绩,填入“XS.DBF的“平均字段。数据处理2显示按“平均字段值的降序显示,显示输出的格式如下:学号 姓名 数学 英语 计算机 平均2000100114 胡小晴 88.0 90.0 89.0 89.02000100107 赵小青 88.8 86.5 89.0 88.1index on 平均 tag pj desc? 学号 姓名 数学 英语 计算机 平均do while !eof() ? 学号, 姓名, b.数学, b.英语, b.计算机, 平均 skipenddo关闭表close ta

60、blesclearset talk offset safety offselect 2use cjindex on 学号 tag xhselect 1use xsset relation to 学号 into breplace all 平均 with (b.数学+ b.英语+ b.计算机)/3index on 平均 tag pj desc? 学号 姓名 数学 英语 计算机 平均do while !eof() ? 学号, 姓名, b.数学, b.英语, b.计算机, 平均 skipenddoclose tablesabc2.PRG32.2.3表单设计文件名:form2.SCX创立表单,添加控件、

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论