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

科目名稱:程式設計 開課系所:資訊工程 學系 任課教師
吳坤熹
系所別:
年級:
學號:
姓名:
考試日期
2010.5.14

(考試時間: 8:10-8:40)

  1. (10%) If we replace the OnDraw() function in P.854 (P.715 in old textbooks) as below, what result will be shown on the screen after you run the program?  Please specify the coordinates of endpoints of each segment.
    void CSketcherView::OnDraw(CDC* pDC)
    {
    CSketcherDoc* pDoc = GetDocument();
    ASSERT_VALID(pDoc);
    if (!pDoc)
    return;

    pDC->Arc(20,20, 180,180, 100,20, 350,100);
    pDC->MoveTo(180,100);
    pDC->LineTo(100,100);
    pDC->LineTo(100,20);
    }





  2. (10%) If we replace the OnDraw() function in P.854 (P.715 in old textbooks) as below, what expression should be filled in the blanks if we want to obtain the following figure?

    void CSketcherView::OnDraw(CDC* pDC)
    {
        CSketcherDoc* pDoc = GetDocument();
        ASSERT_VALID(pDoc);
        if (!pDoc)
            return;

        pDC->Rectangle(100,10, 300, 210);
        for (int i=0; i<10; i++)
            pDC->Ellipse(100, 10+i*10, __________ , _________ );
    }

    Circles