CString CStdioFile

以下便是 MFCCON.CPP 內容:
#0001 // File : MFCCON.CPP
#0002 // Author : J.J.Hou / Top Studio
#0003 // Date : 1997.04.06
#0004 // Goal : Fibonacci sequencee, less than 100
#0005 // Build : cl /MT mfccon.cpp (/MT means Multithreading)
#0006
#0007 #include <afx.h>
#0008 #include <stdio.h>
#0009
#0010 int main()
#0011 {
#0012 int lo, hi;
#0013 CString str;
#0014 CStdioFile fFibo;
#0015
#0016 fFibo.Open("FIBO.DAT", CFile::modeWrite |
#0017 CFile::modeCreate | CFile::typeText);
#0018
#0019 str.Format("%s\n", "Fibonacci sequencee, less than 100 :");
#0020 printf("%s", (LPCTSTR) str);
#0021 fFibo.WriteString(str);
#0022
#0023 lo = hi = 1;
#0024
#0025 str.Format("%d\n", lo);
#0026 printf("%s", (LPCTSTR) str);
#0027 fFibo.WriteString(str);
#0028
#0029 while (hi < 100)
#0030 {
#0031 str.Format("%d\n", hi);
#0032 printf("%s", (LPCTSTR) str);
#0033 fFibo.WriteString(str);
#0034 hi = lo + hi;
#0035 lo = hi - lo;
#0036 }
#0037
#0038 fFibo.Close();
#0039 return 0;
#0040 }

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章