當前位置:編程學習大全網 - 編程軟體 - VFP編程題求解

VFP編程題求解

程序1

clear

"1992-2020年中間的閏年有:"

for year=1992 to 2020

if year%4==0 and year%100!=0 or year%400==0

?year

endif

endfor

程序2

clear

s=0

for i=100 to 999

if i%11=0

if i%10=8 or i/10%10=8 or i/100=8

?i

s=s+1

endif

endif

endfor

"三位數中總***有",s,"個能被11整除同時又含有8的數字"

程序3

clear

a="Long long ago,there was a war between the birds and the beats. No one knows what they fought about.The bat did not know whose side he should take. He thought and thought, "

c="then decided he must try to be on the side of the winners.So he watched from far away. After a while, it seemed that the birds were going to win.He flew over to join them"

b=""

i=1

for j=1 to len(a)

if substr(a,j,1)!=" "

b=b+substr(a,j,1)

endif

endfor

for j=1 to len(c)

if substr(c,j,1)!=" "

b=b+substr(c,j,1)

endif

endfor

b

程序4

input "請輸入數字:" to n

P=2*N-1

FOR I=1 TO P

IF I<=N

?SPACE(N-I+1)

FOR J=1 TO 2*I-1

?"*"

ENDFOR

ELSE

?SPACE(I-N+1)

FOR K=1 TO 2*(2*N-I)-1

?"*"

ENDFOR

ENDIF

ENDFOR

  • 上一篇:麻城博達學校的學校簡介
  • 下一篇:惠普NC6000筆記本電腦的內存最多可以擴展幾個g。
  • copyright 2024編程學習大全網