摘 要: 針對學生難以理解VFP程序中循環語句流程,以及對其難以展開應用的情況,提出了在VFP主界面中使用由“*”符號組成的平行四邊形、倒平行四邊形、三角形、倒三角形、梯形和倒梯形等幾何圖形繪制的方法,以幫助學習者利用VFP這個具有強大功能的PRG編程技術來實現一些DIY程序。程序中采用雙重“For”循環語句進行相應幾何圖形的繪制,淺顯易懂,有助于學生對于VFP程序中循環語句的理解和掌握,效果良好。
關鍵詞: 平行四邊形; 三角形; 梯形; VFP
中圖分類號:TP311.1 文獻標志碼:A 文章編號: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)是一種關系型的數據庫系統[1],通常用于進行數據處理和數據管理及其面向對象設計的軟件。它具有系統功能強大、數據處理速度極高、工具與函數豐富實用、交互界面友好直觀,以及上下兼容性完備等特點。VFP程序提供功能強大的編程技術,可以用于實現某些供調用的過程。
1 經典幾何圖形的繪制
VFP具有功能強大的編程技術[2],學生等初學者可以利用VFP程序(.prg)進行一些應用程序的編寫。這些程序均采用 “For語句”雙重循環在主界面中分別進行了相應的正、倒的平行四邊形、三角形和梯形這些幾何圖形的簡易繪制。
1.1 平行四邊形的繪制
平行四邊形的VFP繪制如圖1所示。以下給出實現的PRG程序,其中變量i控制行數,j控制每行生成的星號的個數;一個問號指的是換行輸出,而二個問號指的是不換行輸出。
2 結束語
程序中使用“For”語句循環繪制出了平行四邊形和倒平行四邊形、三角形和倒三角形、梯形和倒梯形,以幫助學生理解利用VFP的PRG編程技術可以編寫實現某些特定功能的程序。所給程序均采用雙重循環語句進行了相應幾何圖形的繪制,淺顯易懂,效果良好。另外,學生可以嘗試使用循環語句進行100以內素數、完數和水仙花數的求解,以獲得對循環語句的進一步理解和掌握。
參考文獻:
[1] 李雁翎.數據庫技術及應用:Visual FoxPro[M].高等教育出版社,2005.
[2] 李雁翎.Visual FoxPro應用基礎與面向對象程序設計教程 (第二版)[M].高等教育出版社,2002.
[3] 梁李軍.Visual FoxPro及其應用系統設計[M].清華大學出版社,2010.