Visual Foxpro
This presentation is the property of its rightful owner.
Sponsored Links
1 / 150

Visual Foxpro 基 础 PowerPoint PPT Presentation


  • 67 Views
  • Uploaded on
  • Presentation posted in: General

Visual Foxpro 基 础. 第六章. 目的与要求 :. 第六章. 1. 能熟练地建立项目、数据库、表 。. 2. 能正确确定表中各字段的类型、宽度。. 3. 正确理解主索引、候选索引、惟一索引、普通索引的概念,能准确为表选定索引。. 第六章. 准备 :. 1. 添加工具栏. 添加”数据库设计器”:“显示”菜单  “工具栏 …” 命令. 2. 修改默认目录. 即确定工作目录:“工具”菜单  ”选项 …” 命令  “文件位置”标签 修改“默认目录”,单击“设置为默认目录”按钮单击“确定”按钮。 目的是:便于今后保存数据。.

Download Presentation

Visual Foxpro 基 础

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Visual foxpro

Visual Foxpro


Visual foxpro

1.

2.

3.


Visual foxpro

:

1.

2.

3.


Visual foxpro

6.1

6.1

Visual FoxPro(VFP)(Control Center).APP.EXE


Visual foxpro

6.1

6.1.1

CREATE PROJECT < |>

.PJX.PJT


Visual foxpro

6.1

6.1.2


Visual foxpro

6.1

6.1.3

VFP


Visual foxpro

(External Library)(Procedure)

READ EVENTSCLEAR EVENTS

DODO FORM

6.1

6.1.4


Visual foxpro

6.1

6.1.5

:


Visual foxpro

6.1

6.1.6

  • ,,.APP.,VFP,.APP

  • :

  • [].

  • [][][].

  • []

  • BUILD APPBUILD EXE.:XSGLXT.PJXMYAPP.APP,:

  • BUILUD APP MYAPP FROM XSGLXT

  • BUILD EXE MYEXE FROM XSGLXT


6 1 7

6.1.7

6.1

[],,,,,,,.

1.

.[],VFP,,,,,,,,.

2.

,,,, ,.:

,,


Visual foxpro

6.1

6.1.7


Visual foxpro

6.1

6.1.7


Visual foxpro

6.

6.2.1

  • :DISPLAY STRUCTURE [IN NWORKAREA|CTABLEALIAS[TO PRINTER[PROMPT]|TO FILE FILENAME][NOCONSOLE]

  • :.,,,,,,,.

  • :


Visual foxpro

6.

6.2.1

  • IN NWORKAREA|CTABLEALIAS, NWORKAREANWORKAREA; CTABLEALIASCTABLEALIAS.

  • TO PRINTER.

  • TO FILE FLIENAMEFILENAME.

  • NOCONSOLEVFP,.


Visual foxpro

6.

6.2.2

  • 1.

  • :CREATE [FILENAME|?]

  • :VFP.

  • :

  • FILENAME|?FILENAME,?,|.


Visual foxpro

6.

6.2.2

  • 2.

  • (1)

  • :COPY STRUCTURE TO <TABLENAME>[FILEDS<FILEDLIST>]

  • :<TABLENAME>.


Visual foxpro

6.

6.2.2

  • 2

  • :COPY STRUCTURE EXTENDED TO <FILENAME>[DATABASE<DATABASENAME>[NAME<LONGTABLENAME]][FILEDS<FILEDLIST>

  • :,

  • :


Visual foxpro

6.

6.2.2

  • DATABASE<DATABASENAME>,.

  • NAME<LONGTABLENAME>,128.

  • FILEDS<FILEDLIST>.,.


Visual foxpro

6.

6.2.2

  • (3)

  • :CREATE<FILENAME>FROM

  • <TABLESTRUCTUREFILENAME>

  • :..


Visual foxpro

6.

6.2.3

  • :MODIFY STRUCTURE

  • ,.

  • ,,,,,


Visual foxpro

6.3 ,,

6.3.1

  • VFP.

  • 1.:(N)(F).

  • 2.():ASCII,.

  • 3.://YY.MM.DD{04/28/96}{^2001/01/03}.

  • 4.:,,.T.,.Y..F.,.N..

  • 5.


Visual foxpro

6.3 ,,

6.3.2

  • 1.:VFP,

  • 2.:,.

  • 3.

  • (1)

  • :DIMENSION<ARRAYNAME(NROWS1)[,NCOLUMNS1])>[,<ARRAYNME2(NROWS2[,NCOLUMNS2])>]

  • :.


Visual foxpro

6.3 ,,

6.3.2

  • (2)

  • :STORE<EEXPRSSION>TO<ARRAYNAMELIST>

  • 2:<ARRAYNAME>=<EEXPRSSION>

  • :.

  • (3)

  • :SCATTER[FILEDS<FILEDNAMELIST>|FILEDS LIKE<SKELETON>|FILEDS EXCEPT<SKELETON>][MEMO] TO <ARRAYNAME>|TO<ARRAYNAME>BLANK|MEMVAR|NAME<OBJIECTNAME>

  • :.


Visual foxpro

6.3 ,,

6.3.2

  • 4.

  • (1)

  • :STORE<>TO <VARNAMELIST>|<ARRAYNAMELIST>

  • .

  • (2)

  • 1LIST MEMORY[LIKE<FILESKELETON>][TO PRINTER[PROMPT]/TO FILE<FILENAME>][NOCONSOLE]

  • 2:DISPLAY MEMORY[LIKE<FILESKELETON>][TO PRINTER[PROMPT]/TO FILE<FILENAME>][NOCONSOLE]

  • :..


Visual foxpro

6.3 ,,

6.3.2

  • (3)

  • :SAVE TO <FIELNAME>|MEMO<MEMOFIELDNAME>[ALL LIKE <SKELETON>|ALL EXCEPT<SKELETON>

  • ,<FIELNAME>.

  • (4)

  • 1:RELEASE<MEMVARLIST>

  • :

  • 2:CLEAR MEMORY

  • :.


Visual foxpro

6.3 ,,

6.3.3

  • 1.:,.

  • :

  • 1:?<EEXPRESSIONLIST>

  • 2:??>EEXPRESSIONLIST>

  • :,,?,??.

  • 2.:.VFP:,,,,


Visual foxpro

6.4

6.4

FoxPro700

<expN>

<expC>

<expL>

<expD>

<expr>


Visual foxpro

6.4

6.4.1

1ACOS(<expN>)<expN>()()<expN>[-1,1][0,]

2ASIN(<expN>)<expN>()()<expN>[-1,1][-/2,/2]


Visual foxpro

6.4

6.4.1

3ATAN(<expN>)<expN>()()<expN>[-/2,/2]

4ATN2(<expN1>,<expN2>)<expN1><expN2>()ACOS()


Visual foxpro

6.4

6.4.1

5COS(<expN>)<expN><expN>[-1,1]

6SIN(<expN>)<expN><expN>[-1,1]

7TAN(<expN>)<expN>


Visual foxpro

6.4

6.4.1

8FV(<expN1>,<expN2>,<expN3>)<expN1><expN2><expN3>

9PAYMENT(<expN1>,<expN2>,<expN3>)<expN1><expN2><expN3>

10PV(<expN1>,<expN2>,<expN3>)<expN1><expN2><expN3>


Visual foxpro

6.4

6.4.1

11DTOR(<expN>) <expN>

12RTOD(<expN>) <expN>

13 VAL(<expC>) <expC><expC>


Visual foxpro

6.4

6.4.1

14CEILING(<expN>)<expN>

15EVALUATE(<expC>)<expC><expC><expC>FoxPro

16ROUND(<expN1>,<expN2>)<expN1><expN2>


Visual foxpro

6.4

6.4.2

17AT(<expC1>,<expC2>[,<expN>])<expC1><expC2><expN>0<expN>1

18ATC(<expC1>,<expC2>[,<expN>])AT()

19LIKE(<expC1>,<expC2>)<expC1><expC2><expC1>*


Visual foxpro

6.4

6.4.2

20ALLTRIM(<expC>)<expC>

21LEFT(<expC>,<expN>)<expC><expN>

22RIGHT(<expC>,<expN>)<expC><expN>

23SUBSTR(<expC>,<expN1>[,<expN2>])<expC><expN1><expN2><expN1>1<expN2><expC>


Visual foxpro

6.4

6.4.2

24CHRTRAN(<expC1>,<expC2>,<expC3>)<expC1><expC2><expC3><expC3><expC2><expC3><expC2><expC2>


Visual foxpro

6.4

6.4.2

25PADL(<expr>,<expN>[,<expC>])

26PADR(<expr>,<expN>[,<expC>])

27PADC(<expr>,<expN>[,<expC>])

PADL()PADR()PADC()<expr><expC>,<expN>

28STR(<expN1>[,<expN2>[,<expN3>]])<expN1><expN2><expN3><expN2><expN1>


Visual foxpro

6.4

6.4.2

29STRTRAN(<expC1>,<expC2>[,<expC3>][,<expN1>][,<expN2>])<expC1><expC2><expC3><expC1><expN1><expC3><expC1><expN1><expC2>1<expN2>


Visual foxpro

6.4

6.4.3

30CMONTH(<expD>)<expD>

31CTOD(<expC>)<expC><expC>mm/dd/yy

32DATE()SET CENTURYSET DATESET MARK TO


Visual foxpro

6.4

6.4.3

33DAY(<expD>)<expD>131

34MONTH(<expD>)<expD>()

35YEAR(<expD>)<expD>

36DTOC(<expD>[,1])<expD>[1]

37DTOS(<expD>[,1])<expD>yyyy mm dd


Visual foxpro

6.4

6.4.3

38CDOW(<expD>)<expD>

39DOW(<expD>)<expD>

40SECONDS()0

41TIME([<expN>])hh:mm:ss<expN>1/18<expN>


Visual foxpro

6.4

6.4.4

42ALIAS([<expN>|<expC>]) <expN>|<expC>

43DBF([<expN>|<expC>]) <expN>|<expC>


Visual foxpro

6.4

6.4.4

44SELECT([0|1]) 01

45UNIQUE() UNIQUESET UNIQUE ON

46USED([<expN>|<>]) .T..F.


Visual foxpro

6.4

6.4.4

47NDX(<expN>)[,<>|<>|<>) ()(.IDX)<expN><expN>


Visual foxpro

6.4

6.4.4

48CDX(<expN>[,<>|<>])

49MDX(<expN>[,<>|<>])

CDX<expN>()<expN>12l2

MDXCDX


Visual foxpro

6.4

6.4.4

50ORDER([<>|<>[,<expN>]]) ()SET ORDER()()()


Visual foxpro

6.4

6.4.4

51BOF([<expN>|<expC>])<expN>|<expC>

52DELETED([<expN>|<expC>])

53EOF([<expN>|<expC>])<expN>|<expC>


Visual foxpro

6.4

6.4.4

54FCOUNT([<expN>|<expC>])<expN>|<expC>

55FIELD(<expN1>[,<expN2>|<expC>]) <expN2>|<expC><expN1><expN1>1


6 5 1

6.5.1

6.5

1.

:USE[[DATABASENAME!]<TABLE>

|<SQLVIEWNAME>?][IN<NWORKAREA>

<CTABLEALIAS>][AGAIN][ALIAS

<CTABLEALIAS>][EXCLUSIVE][SHARED]

[NOUPADTAE]

:,

.


6 5 11

6.5.1

6.5

2.

:SELECT<NWORKAREA|CTABLEALIAS>|0

:.

3.

1:CLOSE DATABASE

2:CLOSE TABLE

3:CLOSE ALL


6 5 2

6.5.2

6.5

1.INDEX ON

2.USE SET INDEX TO

3.SET ORDER TO

4.REINDEX


6 5 3

6.5.3

6.5

1.GO/GO TO[RECORD]

2.SKIP

3. LOCATE

4.SEEK

5.GETEXPR


6 5 4

6.5.4

6.5

1. COUNT

2.SUM

3. AVERAGE


6 6 visual foxpro

6.6 Visual FoxPro

6.6 Visual FoxPro

1.

2.VFP

3.

4.

5.

6.

7.

168


6 6 visual foxpro1

6.6 Visual FoxPro

6.6 Visual FoxPro

Visual FoxProFoxProXbaseProcedural programmingObject oriented programming


6 6 1

6.6.1

6.6 Visual FoxPro

Visual FoxProASCII

Visual FoxPro.PRG.PRG.FXPVisual FoxPro.PRG

Visual FoxProVisual FoxPro


Visual foxpro

6.6 Visual FoxPro

6.6.1

1.

1


Visual foxpro

6.6 Visual FoxPro

6.6.1

2.

(1)MODIFY COMMAND

MODIFY COMMAND [<>|? [NOEDIT][SAME][SAVE]


Visual foxpro

6.6 Visual FoxPro

6.6.1

(2)DO

DO <>

<>EXE() APP() FXP() PRG()


Visual foxpro

6.6 Visual FoxPro

6.6.1

(3)SET DEFAULT TO

SET DEFAULT TO [<>]

<>MS-DOS\..


6 6 2

6.6.2

6.6 Visual FoxPro

1.


Visual foxpro

6.6 Visual FoxPro

6.6.2

2.?|??

?|?? [<>[PICTURE <>][FUNCTION <>][V <> [AT <>][FONT <>[,<>]][STYLE <>]

13Visual FoxPro

? Visual FoxPro

? Visual FoxPro

? Visual FoxPro

CANCEL


Visual foxpro

6.6 Visual FoxPro

6.6.2

3. ???

??? []

[]


Visual foxpro

6.6 Visual FoxPro

6.6.2

4.STORE|=

1STORE <> TO <>

2<>=<>

2a=6,b=8

3h=16f=40


Visual foxpro

6.6 Visual FoxPro

[]

a=6

b=8

t=a

a=b

b=t

? a=,a

? b=,b

CANCEL


Visual foxpro

6.6 Visual FoxPro

[3]

h=16

f=40

x=(4*h-f)/2

y=(f-2*h)/2

? ,x,

? ,y,

CANCEL


Visual foxpro

6.6 Visual FoxPro

6.6.2

5. INPUT

INPUT [<>] TO <>

4r


Visual foxpro

6.6 Visual FoxPro

[4]

*

INPUT r=TO r &&r

pi=3.14 &&pi

s=pi*r^2 &&

f=4*pi*r^2 &&

v=4/3*pi*r^3 &&

s=ROUND(S,3)

v=round(v,3)

? ,s

? ,f

? ,v

CANCEL


Visual foxpro

6.6 Visual FoxPro

6.6.2

6. ACCEPT

ACCEPT [<>] TO <>

5

ACCEPT TO name

INPUT TO age

?

? ,name,,age

CANCEL


Visual foxpro

6.6 Visual FoxPro

6.6.2

  • 7. WAIT

  • WAIT [<>]

    • [TO <>]

    • [WINDOW [AT <>,<>]]

    • [NOWAIT]

    • [CLEAR|NOCLEAR]

    • [TIMEOUT <>]

  • 6WAIT


  • Visual foxpro

    6.6 Visual FoxPro

    6.6.2

    ? 1 Visual FoxPro

    WAIT

    ? 2 Visual FoxPro

    WAIT WINDOW NOWAIT

    3 Visual FoxPro

    WAIT WINDOW TIMEOUT 3

    CANCEL


    Visual foxpro

    6.6 Visual FoxPro

    8. =

    =<1>[,<2>...]

    Visual FoxPro

    ==


    Visual foxpro

    6.6 Visual FoxPro

    9.CANCEL

    CANCEL

    10.

    (1)NOTE|*

    NOTE|* []

    (2)&&

    &&[]


    Visual foxpro

    6.6 Visual FoxPro

    6.6.2

    • 11. TEXT...ENDTEXT

    • TEXTENDTEXT

    • TEXT

      • <>

  • ENDTEXT

  • 12. \|\\

  • 1\ <>

  • 2\\ <>


  • 6 6 3

    6.6.3

    6.6 Visual FoxPro

    1.


    6 6 31

    6.6 Visual FoxPro

    6.6.3

    • 2.IF

    • IF <>

      • [1]

    • [ELSE

      • [2]]

    • ENDIF

  • IFELSEENDIFIFENDIF

  • .F.else

    .T.


    Visual foxpro

    6.6 Visual FoxPro

    9500.25500.45

    wp


    6 6 visual foxpro2

    6.6 Visual FoxPro

    6.6 Visual FoxPro

    [9]

    *wp

    INPUT TO w

    IF w<=50

    P=0.25*w

    ELSE

    P=50*0.25+(w-50)*0.45

    ENDIF

    ? ,p,

    CANCEL


    Visual foxpro

    6.6 Visual FoxPro

    6.6.3

    10


    6 6 visual foxpro3

    6.6 Visual FoxPro

    6.6 Visual FoxPro

    [10]

    INPUT x=TO x

    IF x>10

    y=x^3

    ELSE

    IF x>=0

    y=x^5

    ELSE

    y=x^2

    ENDIF

    ENDIF

    ? y=,y

    CANCEL


    Visual foxpro

    6.6 Visual FoxPro

    11abcax2+bx+c=0

    abc

    (1)a<>0

    >0

    =0

    <0

    (2)a=0b<>0

    (3)a=0b=0


    Visual foxpro

    6.6 Visual FoxPro

    [11]

    INPUT a=TO a && a,b,c

    INPUT b=TO b

    INPUT c=TO c

    IF a<>0 &&

    delta=b^2-4*a*c

    re=-b/(2*a)

    im=SQRT(ABS(delta))/(2*a)

    IF delta>=0 &&

    root1=re+im

    root2=re-im


    Visual foxpro

    6.6 Visual FoxPro

    ? ,root1,root2

    ELSE &&

    ? ,re,+,im,i,re,-,im,i

    ENDIF

    ELSE

    IF b<>0

    ? ,-c/b

    ELSE

    ?

    ENDIF

    ENDIF

    CANCEL


    Visual foxpro

    6.6 Visual FoxPro

    • 3. DO CASE

    • DO CASE

      • CASE <1>

      • [1]

    • [CASE <2>

      • [2]]

    • [OTHERWISE

      • [n+1]]

    • ENDCASE

    1

    .F.

    .T.

    .F.

    2.T.

    OTHERWISE

    OTHERWISE


    Visual foxpro

    6.6 Visual FoxPro

    121600


    Visual foxpro

    6.6 Visual FoxPro

    5002000100000s500s2000s100000


    Visual foxpro

    6.6 Visual FoxPro

    s500=500*0.05 &&50025

    s2000=s500+(2000-500)*0.10 &&2000175

    s5000=s2000+(5000-2000)*0.15 &&5000625

    s20000=s5000+(20000-5000)*0.20 &&200003625

    s40000=s20000+(40000-20000)*0.25 &&400008625

    s60000=s40000+(60000-40000)*0.30 &&6000014625

    s80000=s60000+(80000-60000)*0.35 &&8000021625

    s100000=s80000+(100000-80000)*0.40 &&10000029625

    INPUT ()TO t

    DO CASE

    CASE t<=500

    s=t*0.05

    CASE t<=2000

    s=s500+(t-500)*0.10

    CASE t<=5000


    Visual foxpro

    6.6 Visual FoxPro

    s=s2000+(t-2000)*0.15

    CASE t<=20000

    s=s5000+(t-5000)*0.20

    CASE t<=40000

    s= s20000+(t-20000)*0.25

    CASE t<=60000

    s=s40000+(t-40000)*0.30

    CASE t<=80000

    s=s60000+(t-60000)*0.35

    CASE t<=100000

    s=s80000+(t-80000)*0.40

    OTHERWISE

    s=s100000+(t-100000)*0.45

    ENDCASE

    ? ,s,

    CANCEL


    6 6 4

    6.6.4

    6.6 Visual FoxPro

    1.

    Visual FoxPro


    Visual foxpro

    6.6 Visual FoxPro

    :

    .F.

    .T.


    Visual foxpro

    6.6 Visual FoxPro

    2. DO WHILE

    DO WHILEENDDO

    .T.

    .F.

    DO WHILE <>

    exit

    .T.loopdo whileloopenddo

    []

    exit

    [EXIT]

    [LOOP]

    ENDDO


    Visual foxpro

    6.6 Visual FoxPro

    145Visual FoxPro

    5xx

    150.5mm8848

    2


    Visual foxpro

    6.6 Visual FoxPro

    14

    vfp= Visual FoxPro

    x=1

    DO WHILE x<=5

    ? vfp

    x=x+1

    ENDDO

    CANCE


    Visual foxpro

    6.6 Visual FoxPro

    [15]

    n=0

    h=0.5

    DO WHILE h<8848000

    n=n+1

    h=2*h

    ENDDO

    ? ,n

    CANCEL


    Visual foxpro

    6.6 Visual FoxPro

    • 3. FOR

    • FOR <><> TO <> [STEP <>]

      • []

      • [EXIT]

      • [LOOP]

    • ENDFOR|NEXT

  • 1612399100

  • x12399100s11s


  • Visual foxpro

    6.6 Visual FoxPro

    [16]

    s=0

    FOR x=1 TO 100

    s=s+x

    ENDFOR

    ? s=,s

    CANCEL


    Visual foxpro

    6.6 Visual FoxPro

    17123420

    ts.

    .

    181111229981


    Visual foxpro

    6.6 Visual FoxPro

    17

    s=0

    t=1

    FOR n=1 TO 20

    t=t*n

    s=s+t

    ENDFOR

    ? s=,s

    CANCEL


    Visual foxpro

    6.6 Visual FoxPro

    18

    FOR a=1 TO 9

    FOR b=1 TO 9

    P=a*b

    ? STR (a,1),"",STR(b,1),"=",STR(p,2)

    ENDFOR

    ?

    WAIT WINDOW

    ENDFOR

    CANCEL


    Visual foxpro

    6.6 Visual FoxPro

    • 4. SCAN

    • Table/.DBF

    • SCAN [NOOPTIMIZE]

      • [<>][FOR|WHILE <>]

      • []

      • [EXIT]

      • [LOOP]

    • ENDSCAN

  • SCAN

  • IFDO CASEDO WHILEFORSCAN


  • 6 6 5

    6.6.5

    6.6 Visual FoxPro

    1.

    (1)

    (2)

    Visual FoxPro


    Visual foxpro

    6.6 Visual FoxPro

    a(5)A(2,3)

    a(4)a(i)a(i+5)

    1a(1)a(2,4)a(0)a(-3,3)


    Visual foxpro

    6.6 Visual FoxPro

    2. DIMENSION

    DIMENSION <> (<1> [,<2>])

    [,<> (<1> [,<2>]),...]

    DIMENSION

    DIMENSION

    DIMENSION a(5),b(2,3),c(8)

    <>

    DIMENSION a(5),b[2,3],c(8)


    Visual foxpro

    6.6 Visual FoxPro

    1STORESCATTERDIMENSION.F.

    DISPLAY MEMORY

    CLEAR

    DIMENSION xx(2,3)

    DISPLAY MEMORY LIKE xx

    xx6.F.


    Visual foxpro

    6.6 Visual FoxPro

    STORE|=

    DIMENSION xx(2,3)

    STORE "AA"TO xx(1,2)

    STORE 5 TO xx(6)

    xx(1)=.T.

    xx(2,2)="HELLO"

    DISPLAY MEMORY LIKE xx

    xx


    Visual foxpro

    6.6 Visual FoxPro

    CLEAR

    DIMENSION yy(5)

    yy=3

    DISPLAY MEMORY LIKE yy


    Visual foxpro

    6.6 Visual FoxPro

    • DIMENSION

    • A.2

      • clear

      • DIMENSION aa(2)

      • STORE ATO aa(1)

      • STORE BTO aa(2)

      • DISPLAY MEMORY LIKE aa


    Visual foxpro

    6.6 Visual FoxPro

    • 4

      • DIMENSION aa(4)

      • STORE ATO aa(1)

      • STORE BTO aa(2)

      • DISPLAY MEMORY LIKE aa


  • Visual foxpro

    6.6 Visual FoxPro

    • B.4

      • clear

      • DIMENSION aa(4) &&aa(4)

      • STORE ATO aa(1)

      • STORE BTO aa(2)

      • STORE CTO aa(3)

      • STORE DTO aa(4)

      • DISPLAY MEMORY LIKE aa

  • .


  • Visual foxpro

    6.6 Visual FoxPro

      • DIMENSION aa(2,3) &&aa(2,3)

      • STORE ATO aa(1)

      • STORE BTO aa(2)

      • STORE CTO aa(3)

      • STORE DTO aa(4)

      • DISPLAY MEMORY LIKE aa


  • Visual foxpro

    6.6 Visual FoxPro

    3.

    1910

    s10suav


    6 6 visual foxpro4

    6.6 Visual FoxPro

    • [19]:

    • clear

    • n=10

    • DIMENSION s(10)

    • STORE 0 TO su,av

    • i=1

    • DO WHILE i<=n

    • cc=""+STR(i,2)+""

    • INPUT cc TO s(i)

    • su=su+s(i)

    • i=i+1

    • ENDDO

    • av=su/n

    • ? "",round(av,1)

    • CANCEL


    Visual foxpro

    6.6 Visual FoxPro

    2110105

    10


    6 6 visual foxpro5

    6.6 Visual FoxPro

    • [21]:

    • *

    • clear

    • SET TALK OFF

    • DIMENSION name(10),number(10),points(10) &&

    • s=0 &&

    • FOR i=1 TO 10 &&

    • INPUT ""+STR(i,1)+"" TO name(i)

    • INPUT ""+STR(i,1)+"" TO number(i)

    • INPUT ""+STR(i,1)+"" TO points(i)

    • s=s+points(i) &&

    • ENDFOR


    6 6 visual foxpro6

    6.6 Visual FoxPro

    • s=s/10

    • first=s*1.1

    • second=s*1.05

    • FOR i=1 TO 10

    • IF points(i)>first

    • ? name(i),number(i),points(i),""

    • ELSE

    • IF points(i)>second

    • ? name(i),number(i),points(i),""

    • ENDIF

    • ENDIF

    • ENDFOR

    • CANCEL


    Visual foxpro

    6.6 Visual FoxPro

    4.

    2235

    ss(i,j)ij35


    6 6 visual foxpro7

    6.6 Visual FoxPro

    • [22]:

    • clear

    • DIMENSION s(3,5) &&

    • i=1

    • DO WHILE i<=3 &&

    • j=1

    • DO WHILE j<=5

    • ts=""+STR(i,1)+""+STR(j,1)+""

    • INPUT ts TO s(i,j)

    • j=j+1

    • ENDDO

    • i=i+1

    • ENDDO


    6 6 visual foxpro8

    6.6 Visual FoxPro

    • ? "COURSE","AVERAGE" &&

    • j=1

    • DO WHILE j<=5 &&

    • su=0

    • i=1

    • DO WHILE i<=3

    • su=su+s(i,j)

    • i=i+1

    • ENDDO

    • av=ROUND(su/5,1) &&

    • ? j,av

    • j=j+1

    • ENDDO

    • CANCEL


    6 6 6

    6.6.6

    6.6 Visual FoxPro

    1.


    6 6 61

    6.6 Visual FoxPro

    6.6.6

    (1) DO

    Visual FoxPro

    DO <>|<>[WITH<>]


    6 6 62

    6.6 Visual FoxPro

    6.6.6

    (2)

    RETURN [TO MASTER|TO <>|<>]


    Visual foxpro

    sprg.prg

    DO sprg

    DO sprg

    CANCEL

    RETURN

    6.6 Visual FoxPro

    DO sprgRETURNDODO sprgRETURNDO


    Visual foxpro

    sprg1.prg

    sprg2.prg

    DO sprg2

    RETURN

    RETURN

    6.6 Visual FoxPro

    DO sprg1

    CANCEL


    Visual foxpro

    sprg1.prg

    sprg2.prg

    DO sprg2

    RETURN

    RETURN TO MASTER

    6.6 Visual FoxPro

    RETURNTO MASTERDO

    DO sprg1

    CANCEL


    Visual foxpro

    6.6 Visual FoxPro

    (3)

    MODIFY COMMAND

    RETURN.PRG


    Visual foxpro

    6.6 Visual FoxPro

    24s=a!+b!+c!

    s=a!+b!+c!a!b!c!3p!ppsps=p!pss


    Visual foxpro

    6.6 Visual FoxPro

    • [24]:

    • CLEAR

    • INPUT "a="TO a

    • INPUT "b="TO b

    • INPUT "c="TO c

    • s=0

    • ps=1

    • p=a

    • DO E:\TZW\\\eg24jc.prg

    • s=ps

    • p=b

    • DO E:\TZW\\\eg24jc.prg

    • s=s+ps

    • p=c


    Visual foxpro

    6.6 Visual FoxPro

    • DO E:\TZW\\\eg24jc.prg

    • s=s+ps

    • ? "s=",s

    • CANCEL

    • *eg24jc.prgE:\TZW1\\

    • * eg24jc.prg

    • ps=1

    • FOR i=1 TO p

    • ps=ps*i

    • ENDFOR

    • RETURN


    Visual foxpro

    6.6 Visual FoxPro

    2.

    Visual FoxPropublicprivate

    (1)


    Visual foxpro

    6.6 Visual FoxPro

    (2)

    RELEASE

    1PUBLIC <>|ALL|ALL LINK <>|ALL EXCEPT <>

    2PUBLIC [ARRAY]<>(<1>[,<2>])[,<>(<1>[,<2>]),]


    Visual foxpro

    6.6 Visual FoxPro

    (3)

    PRIVATE <>|ALL|ALL LIKE <>|ALL EXCEPT <>


    Visual foxpro

    6.6 Visual FoxPro

    28

    aaaaa


    Visual foxpro

    6.6 Visual FoxPro

    • [28]:

    • a=10

    • ? "111",a

    • DO E:\TZW\\\eg28jb1.prg

    • ? "222",a

    • a=15

    • ? "333",a

    • DO E:\TZW\\\eg28jb2.prg

    • ? "444",a

    • CANCEL

    • *eg28jb1.prg

    • PRIVATE a

    • a=20

    • ? "jb1",a

    • return *eg28jb2.prg

    • PRIVATE a

    • a=30

    • ? "jb2",a

    • return


    6 6 63

    6.6 Visual FoxPro

    6.6.6

    3.


    6 6 64

    6.6 Visual FoxPro

    6.6.6

    (1)

    29

    sgaokuan


    Visual foxpro

    6.6 Visual FoxPro

    • [29]:

    • gao=5

    • kuan=6

    • s=0

    • DO E:\TZW\\\eg29jxmj.prg

    • ? s

    • CANCEL

    • *eg29jxmj.PRG

    • s=gao*kuan

    • RETURN


    6 6 65

    6.6 Visual FoxPro

    6.6.6

    (2)

    PARAMETERSDO

    DOWITH<><>

    PARAMETERS <>

    30


    Visual foxpro

    6.6 Visual FoxPro

    • [30]:

    • gao=5

    • kuan=6

    • mj=0

    • DO E:\TZW\\\eg30jxmj WITH gao,kuan,mj

    • ? mj

    • CANCEL

    • *eg30jxmj.prg

    • PARAMETERS g,k,m

    • m=g*k

    • RETURN


    6 6 66

    6.6 Visual FoxPro

    6.6.6

    4.

    Visual FoxPro(User Defined Function)UDFUFDUDFUDF

    Visual FoxProUDFUDFUDF


    6 6 67

    6.6 Visual FoxPro

    6.6.6

    • (1)

    • RETURN

    • [PARAMETERS<>]

      • [PRIVATE ALL]

      • []

      • RETURN [<>]

  • 31


  • Visual foxpro

    6.6 Visual FoxPro

    • [31]:

    • x=1

    • DO WHILE x<=10

    • ? x,cube(x) &&cube(x)

    • x=x+1

    • ENDDO

    • CANCEL

    • *cube.prg

    • PARAMETERS v

    • PRIVATE ALL

    • vt=v*v*v

    • RETURN vt


    Visual foxpro

    6.6 Visual FoxPro

    • (2)

    • FUNCTION<>

    • FUNCTION <>

      • [PARAMETERS <>]

      • [PRIVATE ALL]

      • []

    • RETURN [<>]

  • 3231


  • Visual foxpro

    6.6 Visual FoxPro

    • [32]:

    • x=1

    • DO WHILE x<=10

    • ? x,cube(x)

    • x=x+1

    • ENDDO

    • CANCEL

    • *cube

    • FUNCTION cube

    • PARAMETERS v

    • Private ALL

    • RETURN v*v*v


    Visual foxpro

    6.6 Visual FoxPro

    5.

    MODIFY COMMAND

    (1)

    PROCEDURE <>

    35s1.prgs2.prgs3.prgeg35.prg


    Visual foxpro

    6.6 Visual FoxPro

    (2)

    SET PROCEDURE TO [<>]

    3625eg36yuan.prg


    6 6 visual foxpro9

    6.6 Visual FoxPro

    • [36]:

    • SET PROCEDURE TO E:\TZW\;

    • \\eg36yuan.prg

    • DO WHILE .T.

    • CLEAR

    • ? "****************"

    • ? " 1."

    • ? " 2."

    • ? " 3."

    • ? " 0. "

    • ? "*************************"

    • WAIT "" TO xh

    • DO CASE

    • CASE xh="0"

    • EXIT


    6 6 visual foxpro10

    6.6 Visual FoxPro

    • CASE xh="1"

    • DO E:\TZW\\\eg25ymj.prg

    • CASE xh="2"

    • DO E:\TZW\\\eg25yzc.prg

    • CASE xh="3"

    • DO E:\TZW\\\eg25ytj.prg

    • ENDCASE

    • ENDDO

    • RETUR

    • *eg36yuan.prg

    • **********

    • PROCEDURE ymj

    • INPUT "" TO r

    • s=3.1415926*r^2

    • ? s

    • WAIT

    • RETURN


    6 6 visual foxpro11

    6.6 Visual FoxPro

    • *eof:ymj

    • **********

    • PROCEDURE yzc

    • INPUT "" TO r

    • s=2*3.1415926*r

    • ? s

    • WAIT

    • RETURN

    • *eof:yzc

    • **********

    • PROCEDURE ytj

    • INPUT "" TO r

    • s=4/3*3.1415926*r^3

    • ? s

    • WAIT

    • RETURN

    • *eof:ytj


    Visual foxpro

    6.6 Visual FoxPro

    1.

    2.

    3.


  • Login