國立暨南國際大學 112 學年度第二學期小考試卷

科目名稱:程式設計 開課系所:資訊工程 學系 考試日期 2024.5.3
系所別:
年級:
學號:
姓名:
考試時間 08:10-08:20
  1. (10%) Consider an MFC application with the following OnDraw() function.  If we expect the program will draw a figure as below, what should be the expression at (1)?
    /* Ellipse */
    void CEX01View::OnDraw(CDC* pDC)
    {
        CEX01Doc* pDoc = GetDocument();
        ASSERT_VALID(pDoc);
        if (!pDoc)
            return;

        const int x = 400;
        for (int i = 0; i < 10; ++i)
            pDC->Ellipse(          (1)          );   
    }

    Ellipse

  2. (10%) Consider an MFC application with the following OnDraw() function.  If we expect the program to draw a figure as below, what should be the expressions at (1), (2), and (3)?
    /* CBrush */
    void CEX01View::OnDraw(CDC* pDC)
    {
        CEX01Doc* pDoc = GetDocument();
        ASSERT_VALID(pDoc);
        if (!pDoc)
            return;

        const int x = 1000;
        const int y = x / 1.618;

        CBrush aBrush(       (1)    );
        pDC->SelectObject(   (2)    );
        pDC->Rectangle(0, 0, x/3, y);
        CBrush bBrush(RGB(255, 0, 0));
        pDC->SelectObject(   (3)    );
        pDC->Rectangle(2 * x / 3, 0, x, y);   
    }

    France