摘 要: 針對(duì)學(xué)生難以理解VFP程序中循環(huán)語句流程,以及對(duì)其難以展開應(yīng)用的情況,提出了在VFP主界面中使用由“*”符號(hào)組成的平行四邊形、倒平行四邊形、三角形、倒三角形、梯形和倒梯形等幾何圖形繪制的方法,以幫助學(xué)習(xí)者利用VFP這個(gè)具有強(qiáng)大功能的PRG編程技術(shù)來實(shí)現(xiàn)一些DIY程序。程序中采用雙重“For”循環(huán)語句進(jìn)行相應(yīng)幾何圖形的繪制,淺顯易懂,有助于學(xué)生對(duì)于VFP程序中循環(huán)語句的理解和掌握,效果良好。
關(guān)鍵詞: 平行四邊形; 三角形; 梯形; VFP
中圖分類號(hào):TP311.1 文獻(xiàn)標(biāo)志碼:A 文章編號(hào):1006-8228(2013)04-32-02
Drawing classical geometrical figures based on VFP
Huang Yequan
(Enrolment and Vocation Guidance Office, Huizhou Radio and Television University, Huizhou, Guangdong 516007, China)
Abstract: Aiming at the situation that it is difficult for students to understand the procedure of VFP’s circulations, a way of writing application program is introduced, to draw some classical geometrical figures with the star character in the VFP main interface. It helps students utilize the powerful PRG-programmer of VFP to write their DIY programs. The classical geometrical figures include a parallelogram, an inverted parallelogram, a triangle, an inverted triangle, a trapezoid and an inverted trapezoid. Double circulation is adopted to draw these geometrical figures and get a good effect. It helps students to understand and to master the theory of circulation of VFP.
Key words: parallelogram; triangle; trapezoid; VFP
0 引言
Microsoft Visual FoxPro 6.0 (縮寫為MS VFP 6.0)是一種關(guān)系型的數(shù)據(jù)庫系統(tǒng)[1],通常用于進(jìn)行數(shù)據(jù)處理和數(shù)據(jù)管理及其面向?qū)ο笤O(shè)計(jì)的軟件。它具有系統(tǒng)功能強(qiáng)大、數(shù)據(jù)處理速度極高、工具與函數(shù)豐富實(shí)用、交互界面友好直觀,以及上下兼容性完備等特點(diǎn)。VFP程序提供功能強(qiáng)大的編程技術(shù),可以用于實(shí)現(xiàn)某些供調(diào)用的過程。
1 經(jīng)典幾何圖形的繪制
VFP具有功能強(qiáng)大的編程技術(shù)[2],學(xué)生等初學(xué)者可以利用VFP程序(.prg)進(jìn)行一些應(yīng)用程序的編寫。這些程序均采用 “For語句”雙重循環(huán)在主界面中分別進(jìn)行了相應(yīng)的正、倒的平行四邊形、三角形和梯形這些幾何圖形的簡易繪制。
1.1 平行四邊形的繪制
平行四邊形的VFP繪制如圖1所示。以下給出實(shí)現(xiàn)的PRG程序,其中變量i控制行數(shù),j控制每行生成的星號(hào)的個(gè)數(shù);一個(gè)問號(hào)指的是換行輸出,而二個(gè)問號(hào)指的是不換行輸出。
2 結(jié)束語
程序中使用“For”語句循環(huán)繪制出了平行四邊形和倒平行四邊形、三角形和倒三角形、梯形和倒梯形,以幫助學(xué)生理解利用VFP的PRG編程技術(shù)可以編寫實(shí)現(xiàn)某些特定功能的程序。所給程序均采用雙重循環(huán)語句進(jìn)行了相應(yīng)幾何圖形的繪制,淺顯易懂,效果良好。另外,學(xué)生可以嘗試使用循環(huán)語句進(jìn)行100以內(nèi)素?cái)?shù)、完數(shù)和水仙花數(shù)的求解,以獲得對(duì)循環(huán)語句的進(jìn)一步理解和掌握。
參考文獻(xiàn):
[1] 李雁翎.數(shù)據(jù)庫技術(shù)及應(yīng)用:Visual FoxPro[M].高等教育出版社,2005.
[2] 李雁翎.Visual FoxPro應(yīng)用基礎(chǔ)與面向?qū)ο蟪绦蛟O(shè)計(jì)教程 (第二版)[M].高等教育出版社,2002.
[3] 梁李軍.Visual FoxPro及其應(yīng)用系統(tǒng)設(shè)計(jì)[M].清華大學(xué)出版社,2010.