64,653
社区成员
发帖
与我相关
我的任务
分享
int lo,hi;
CString str;
CStdioFile fFibo;
fFibo.Open((LPCTSTR)"FIBO.dat",CFile::modeWrite|CFile::modeCreate);
str.Format(_T("%s\n"),"Fibonacci sequencee, less than 100 :");
printf("%s\n",(LPCTSTR)str);
fFibo.WriteString(str);
lo=hi=1;
str.Format(_T("%d\n"),lo);
printf("%s\n",(LPCTSTR)str);
//cout<<str;
while(hi<100)
{
str.Format(_T("%d\n"),hi);
printf("%s\n",(LPCTSTR)str);
//cout<<str;
fFibo.WriteString(str);
hi=hi+lo;
lo=hi-lo;
}
fFibo.Close();
getchar();