國立暨南國際大學 97 學年度第一學期小考試卷

科目名稱:資訊系統 與網路導論 開課系所:資訊工程 學系 任課教師
吳坤熹
系所別:
年級:
學號:
姓名:
考試日期
2009.3.18

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


  1. (10%) Determine whether the following code has syntax erros or not.  If it is correct, predict its output.  If it is incorrect, point out the mistake(s).
    #include <iostream>
    using std::cout;

    struct Circle
    { int x, y, r;
    };

    struct LinkedList
    { Circle C;
    LinkedList* pNext;
    };

    void ShowCircle(Circle c)
    {
    cout << "center: (" << x << "," << y << ")\t radius: "
    << r << "\n";
    }

    int main(void)
    {
    Circle C1 = {1, 2, 3};
    Circle C2 = {4, 5, 6};
    ShowCircle(C1);
    LinkedList* p = new LinkedList;
    p->C = C1;
    p->pNext = new LinkedList;
    p->pNext->C = C2;
    ShowCircle(p->pNext->C);
    }