以下便是 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 }
标签:CFile,CStdioFile,WriteString,lo,CString,hi,str,fFibo From: https://www.cnblogs.com/ioriwellings/p/15570920.html