• <td id="hiw6o"></td>
  • 計(jì)算機(jī) - 話(huà)題

    南京大學(xué)2009年上機(jī)試題
    查看(1435) 回復(fù)(0)
    lyh2006
    • 積分:1982
    • 注冊(cè)于:2010-08-01
    發(fā)表于 2010-09-08 00:17
    樓主
    要求寫(xiě)一個(gè)整數(shù)集合的類(lèi),分別放在intset.h和intset.cpp中,以實(shí)現(xiàn)下列程序功能。
    #include "intset.h"
    #include <iostream>
    using namespace std;

    int main()
    {

    IntSet s1, s2, s3, s4;

    int x;

    for(cin >> x; x != 0; cin >> x)

    s1.insert(x);//在s1中插入元素

    for(cin >> x; x != 0; cin >> x)

    s2.insert(x);//在s2中插入元素

    if(s1.IsEqual(s2))//比較s1與s2是否相等

    cout << " s1 is equal s2 ";

    s3 = s3.union2(s1, s2);//求s1與s2的交

    s4 = s4.incorporate2(s1, s2);//求s1與s2的并

    cout << "
    s1:";

    s1.print();//輸出s1中的元素

    cout << "
    s2:";

    s2.print();

    cout << "
    s3:";

    s3.print();

    cout << "
    s4:";

    s4.print();

    return 0;
    }

    回復(fù)話(huà)題
    上傳/修改頭像

    湖南省省會(huì)城市是哪里?(答案為兩個(gè)字)

    考研論壇提示:
    1、請(qǐng)勿發(fā)布個(gè)人聯(lián)系方式或詢(xún)問(wèn)他人聯(lián)系方式,包括QQ和手機(jī)等。
    2、未經(jīng)允許不得發(fā)布任何資料出售、招生中介等廣告信息。
    3、如果發(fā)布了涉及以上內(nèi)容的話(huà)題或跟帖,您在考研網(wǎng)的注冊(cè)賬戶(hù)可能被禁用。

    網(wǎng)站介紹 | 關(guān)于我們 | 聯(lián)系方式 | 廣告業(yè)務(wù) | 幫助信息
    ©1998-2015 ChinaKaoyan.com Network Studio. All Rights Reserved.

    中國(guó)考研網(wǎng)-聯(lián)系地址:上海市郵政信箱088-014號(hào) 郵編:200092 Tel & Fax:021 - 5589 1949 滬ICP備12018245號(hào)