#include <afx.h>
#include <stdio.h>

int main(void)
{
    int lo, hi;
    CString str;
    CStdioFile fFibo;
    
    fFibo.Open("FIBO.DAT", CFile::modeWrite |
        CFile::modeCreate | CFile::typeText);
    
    str.Format("%s\n", "Fibonacci sequencee, less than 100 :");
    printf("%s", (LPCTSTR) str);
    fFibo.WriteString(str);
    
    lo = hi = 1;
    
    str.Format("%d\n", lo);
    printf("%s", (LPCTSTR) str);
    fFibo.WriteString(str);
    
    while (hi < 100)
    {
        str.Format("%d\n", hi);
        printf("%s", (LPCTSTR)str);
        fFibo.WriteString(str);
        hi = lo + hi;
        lo = hi - lo;
    }
    
    fFibo.Close();
    return 0;
}



要设置如下才能通过编译:
Project->settings->c/c++

Catagory 选择“Code Generation

use run-time library”选择“debug multithreaded