VFP答案

更新时间:2023-11-19 23:13:01 阅读量: 教育文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

第1章 习题1

1.(1)数据内容、数据形式(2)定义、操作、控制、管理 (3)人工管理、文件管理、数据库管理(5)记录、字段

(6)投影、选择、连接(7)数据结构化、数据共享性、数据独立性、数据完整性和安全性、数据的最小冗余度(8)主窗口、命令窗口(9)16MB,100MB,240MB(10)文件、数据、文档、对象,.pjx

2、(1)C(2)D(3)B(4)D(5)C(6)D(7)D(8)B 第2章 习题21.

(1)所赋值的类型(2)10(3)C(4)标准,用户自定义(5)数值运算→关系运算→逻辑运算(6)1.256 68(7)类型相同 , 内存(8)OLE,4

2.(1)A(2)A(3)D(4)B(5)C(6)A (改为254)(7)C(8)C(9)B(10)B(11)D(12)C(13)C(14)D

实验34、use xsxxb copy to xsxxb1 for 是否团员

5、use xsxxb copy to xsxxb2 for 性别='男' fields 学号,姓名,性别,民族,班级代码,出生日期,籍贯,照片

6、use xsxxb2 dele for 学号='2003903' pack locate for 学号='2003001' insert before &&输入记录数据

7、(1) use xsxxb index on 班级代码+学号 to bjxhidx

8use xsxxb copy xsxxb3 alter table xsxxb3 add column 人数 N(3,0) use xsxxb3 repl all 人数 with 1 index on 班级代码 to bjrsidx total on班级代码 to xsxxb30 use xsxxb30 list班级代码,人数 use

10、顺序查询方法:(1)use xsxxb locate for year(出生日期)=1988 disp (2) use xsbjb locate for 班级名称='2003级2班' bh=班级代码 use xsxxb locate for 性别='男' and 班级代码=bh disp

(3)use xsxxb loca for 姓名='秦颖'xh=学号use xscjb loca for 学号=xh disp use

索引方法:(1)use xsxxb index on year(出生日期) to rsidx find 1988 disp (2) use xsbjb index on班级名称 to bjmcidx find 2003级2班 bh=班级代码 use xsxxb

locate for 性别='男' and 班级代码=bh disp

(3)use xsxxb index on姓名 to xmidx find 秦颖 xh=学号 use xscjb index on 学号 to xhidx seek xh disp use

11use xscjb repl all总分with语文+数学+物理+化学+英语,平均分with总分/5 use 12、use xscjb sort to xscjb1 on 总分/d,英语/d

13、use xscjb copy to xscjb2 fiel 学号,语文,数学,英语,物理,化学use 15.use xscjb2 sum语文,数学,英语,物理,化学 to a1,a2,a3,a4,a5 append blank repl语文 with a1,数学 with a2,英语 with a3,物理 with a4,化学 with a5 use 18.(1) create database xsgjsjk open database xsgjsjk add table xsxxb add table

xsbjb add table xscjb 习题3

9.(1) use zgb disp go bott disp (2)1) disp record 52) go 5 disp next 2 3) go 5 disp next 3 4) go 5 disp rest

(3) list for 基本工资>=600 and 基本工资<=900 (4) list for 出生时间 <{^1949-10-1}

(5) list for 工作时间<{^1990-1-1} and 性别='女' or 工作时间<{^1995-1-1} ;

and 性别='男' fiel 编号,姓名,性别,工作时间,出生时间,籍贯

(6) list fiel 编号,姓名,性别,民族,技术职称,基本工资,婚否 ; for 基本工资<=900 and 婚否=.T. or基本工资>650 and婚否=.F. (7) list for left(姓名,2)='赵' or '萍' $姓名

(8) LIST FOR right(alltrim(编号),3)='001' AND性别='男' ;

OR LEFT(alltrim(编号),4)<'1993'

12.use zgb

copy to zgb1 for 婚否=.T. use zgb1 append from zgb for 婚否=.F. dele for 姓名='王军' PACK dele for姓名='张萍' use 14. use zgb copy to zgb2 use zgb2

repl all 基本工资 with基本工资*1.1 for 性别='男' repl all 基本工资 with基本工资*1.15 for 性别='女' use 19. (1) use zgb

sort on 基本工资/D to zgb31 for 性别='男' fields 编号,姓名,性别,民族,技术职称,基本工资 use

20.(1) use zgb index on 编号 to bhidx 21.顺序查询方法:

(1)use zgb loca for year(工作时间)=1992 AND 性别='男' disp

(2)use bmb loca for 名称='信息系' bmh=代码 use zgb loca for 工作部门=bmh disp use

22.(1) use zgb count for 工作时间>={^1991-1-1} to rs1 ?'1990年以后工作的人数:',rs1

(2)sum 基本工资 for 性别='男' to gz1 aver基本工资 for 性别='女' to gz2 ?gz1,gz2

(3)calc MAX(基本工资),MIN(基本工资) to max1,min1 ?max1,min1

(4) use zgb index on 工作部门 to bmidx fiel基本工资 total on 工作部门 to zgb41 use zgb41 list工作部门, 基本工资 use

(5) use zgb alter table zgb add column 人数 N(4,0) repl all 人数 with 1 index on 技术职称 to zcidx total on技术职称to zgb42 fiel 人数 use zgb42

list技术职称, 人数 use 第4章 习题4

2.(1)A(2)B(3)A(4)C(5)D(6)D(7)A(8)B(9)B(10)B(11)B(12)D(13)D

3.(1)group by, order by(2)NULL(3)SUM、AVG(4)into curso(5)条件(6)修改(7)浏览(8)更新条件(9)本地视图,远程视图 (10)字段,筛选

第5章 习题5 4.(1)98(2)125

5.set talk off input 'x=' to x if int(x/2)=x/2 && mod(x,2)=0 ?'x偶数' else ?'x奇数' endif

6. *第6题 set talk off clea accept '输入一个表名(不含扩展名.DBF):' to dbfile if file(\该表文件不存在!' endif return

7.*第7题 set talk off m= month(date()) do case case m=3 or m=4 or m=5 ?'春季' case m=6 or m=7 or m=8 ?'夏季' case m=9 or m=10 or m=11 ?'秋季' case m=12 or m=1 or m=2 ?'冬季endcase return

8.*第8题set talk off clea input '输入成绩:' to sc do case case sc>=90 and sc<=100 ?'优' case sc>=80 and sc<90?'良' case sc>=70 and sc<80 ?'中' case sc>=60 and sc<70 ?'及格' case sc>=0 and sc<60 ?'不及格' otherwise ?'输入错误' Endcase return

12.(1)32 3(2)I= 6 S= 33M= 120 (3)36 9 0 (4)FEDCBA

(5)5 10 15 20 25 30 35

13.*第13题set talk off clea n=1 y=1 do while y<10000 y=y+2^n n=n+1 enddo ?Y return

14.*第14题set talk off clea y=0 for n=1 to 10 p=1 for i=1 to n p=p*i endfor y=y+p endfor ?'1!+2!+...+10!=',Y return

15.*第15题set talk off clea input '输入一个奇数:' to n if mod(n,2)=0 or n<=0 ?'错误:输入的数是偶数或者负数.' return

Endif y=0 for i=1 to n step 2 y=y+i endfor?'1+3+...+'+alltrim(str(n))+' = '+alltrim(str(y)) return

17.set talk off*第 17题dime a(3,5) ?'输入15个数,每行输入一个数:'for i=1

to 3 for j=1 to 5 input to a(i,j) endfor endfor

store a(1,1) to max,min store 0 to min_row,min_col,max_row,max_col for i=1 to 3 for j=1 to 5 if maxa(i,j) min=a(i,j) min_row=i min_col=j endif endfor endfor

?'最大元素:'+alltrim(str(max))+',行='+alltrim(str(max_row))+',列='+alltrim(str(max_col))

?'最小元素:'+alltrim(str(min))+',行='+alltrim(str(min_row))+',列='+alltrim(str(min_col)) return

19. use zgb

select 技术职称,count(*) as 人数 into table rs group by 技术职称 use rs scan ?技术职称,人数 endscan use dele file rs.dbf return

20.*第20题use zgb scan

y=year(date()-工作时间) do case

case y<10 repl 基本工资 with 基本工资+20

case y>=10 and y<=20 repl 基本工资 with 基本工资+50 otherwise repl 基本工资 with 基本工资+100 Endcase endscan use

21.*第21题 set talk off clear use zzmmb in 0 use zgb in 0 sele zzmmb scan sele zgb

repl all 政治面貌 with zzmmb->代码 for 政治面貌=zzmmb->名称 sele zzmmb endscan close all return 22.

*第22题 set talk off clear create table mzb(代码 C(2),名称 C(8)) use zgb in 0 sele zgb index on 民族 to mzidx unique n=1

scan bh=alltrim(str(n)) sele mzb append blank repl 代码 with bh,名称 with zgb->民族 sele zgb n=n+1 endscan

clos all use mzb in 0 use zgb in 0 sele mzb scan sele zgb repl all 民族 with mzb->代码 for 民族=mzb->名称 sele mzb Endscan clos all return 29.3 0 2 31.(1) 主程序如下

set talk off clear s=0 input 'n=' to n do sub31 with s,n ?'s=1+2+3+...+'+alltrim(str(n))+'=',alltrim(str(s)) return (2)子程序如下:*子程序 sub31.prg para x,y x=0 for i=1 to y x=x+i endfor return

第6章 习题6

1(1)D(2)C(3)B(4)C(5)D(6)C(7)A(8)D(9)C(10)A(11)C(12)C(13)C(14)A(15)B(16)C(18)D

2.(1)类(2)对象(3)事件(4)面向对象程序设计(5)属性,事件,方法 第7章 习题7

1.(1)B(2)A(3)B(4)A(5)B(6)D(7)D(8)A(9)C(10)B(11)B(12)C(13)D(14)B(15)C(16)A

2.(1)release thisform(2).SCX,Name,Caption(3)Value(4)Init,Enabled(5)焦点(6)AutoCenter(7)容器,4(8)3(9)SKIP Enabled=.f.

(10)ControlSource(11) Load,Activate(12) 选择(13)Column(14) 文本框(15) 2(16)PageCount

习题8参考答案 1.报表文件的扩展名是.frx

2.创建报表的方法有3种:报表向导、快速报表、报表设计器。 3.参见课本P280-281的报表带区内容

4.域控件主要用于输出字段、内存变量或者表达式的值时使用。可输出数值、字符串、逻辑型、日期型等类型的数据。

5.首先选中报表工具栏的标签控件按钮,然后单击需要修改的标签,即可插入、删除和修改标签文字

7.OLE控件的图片来源有图形文件和数据表的通用字段。 8.设置报表的数据环境的过程: 1)打开报表设计器

2)在报表设计器上右击,从快捷菜单中选择“数据环境”菜单项。

3)在数据环境设计器窗口中,右击,从快捷菜单中选择“添加”菜单项,再选择需要作为报表数据源的表或视图。

9.选择要修改的域控件或标签控件,选择“显示”菜单的“字体”菜单项,在对话框中可以的域控件或标签控件的字体、字号。

10.报表变量主要用于在报表中输出一些计算结果时使用。 11.快速报表的操作过程: 1)打开报表设计器 2)设置报表的数据源

3)选择“报表”菜单的“快速报表”菜单项,执行快速报表功能。

12.报表向导是用一个表和一个视图的数据来创建报表。而一对多报表向导是利用两个相关的表来创建一个包含一组父表记录和相关子表记录的的报表。

13.对于报表中某列数据在数据表或视图中不存在,而是通过计算得到的,就需要使用计算字段。

本文来源:https://www.bwwdw.com/article/68ov.html

Top