الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

[مخالف]مساعدة ضروري جدا حل سؤاال بلغة الـC++ لمادة الاوبجكت (OPP)

مغلق
بدأه محمد92 في 29 أبريل 2012 · 1 رد · 207 مشاهدة · في ارشيف قسم C/C++
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

Create a class integerSet for which every object can hold integers in the range 1 – 100use an internal array that holds ones and zeros to store elements in set. arr[ k ] = 1 if integer k is in the set and arr[ k ] = 0 if integer k is not in the set. Write a default constructor to initialize a set to an empty set and also write a copy constructor. A utility function isInRange must be implemented to test if the number is in range 1 – 100 or notUse the following class interface, integerSet, to write an implementation that supports

the following operators:

• (+) operator to insert an element

• (+) operator to find the union of two sets

• (-) operator to delete an element

• (-) operator to find elements in one set and not in the other

• (*) operator to find the intersection of two set

• (<<) operator to print the contents of a set.

• (!) operator to empty set.

class integerSet

{

friend ostream& operator<<(ostream&, integerSet);

friend operator! (integerSet &);

private:

int arr [ 101 ];

bool isInRange(int); // utility function to check if the number in range or not

public:

integerSet( ); // constructor to initialize object to an empty set

integerSet( const integrSet & ); //copy constructor

void operator + ( int ); // to insert element

integerSet operator + (integerSet); // to find the union of two sets

void operator - ( int ); // to delete element

integerSet operator - (integerSet); // to find elements in one set and not in the

//other set

integerSet operator * (integerSet); // to find the intersection of two sets

};

#2

الأخ الكريم/الأخت الكريمة

السلام عليكم ورحمة الله وبركاته

مرحباً بكم في منتدى الفريق العربي للبرمجة

تأسف إدارة المنتدى لغلق الموضوع وذلك لمخالفته قوانين المشاركات .

قواعد طرح المشاركات

/index.php?showtopic=29343

شاكرين لكم حُسن تعاونكم

{username}

مدونتي: C++ Tips and Tricks

هذا الموضوع مغلق.

مواضيع مشابهة

عدد الزوار حالياً

المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية

—الإجمالي—أعضاء مسجّلون—زوار بدون تسجيل

جارٍ التحقق من المتواجدين…