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

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

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

  1. (10%) If we replace the OnDraw() function in P.953 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;

    for (int i=0; i<5; i++)
    pDC->Rectangle(i*10, i*10, 90-i*10, 90-i*10);
    }





  2. (10%) If we replace the OnDraw() function in P.953 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;

        CRect* pRect = new CRect(100,100,300,300);
        CPoint Start(200,150);
        CPoint Midway(300,100);
        CPoint End(250,200);
        pDC->Arc(pRect, Start, End);
        pDC->MoveTo(Start);
        pDC->LineTo(Midway);
        pDC->LineTo(End);
        delete pRect;
    }