class IntSet
{
private:
vector <int> Ints;
int element [100];
int n, seeknumber;
public:
IntSet ()
{
cout << "Enter the following integer:";
cin >> n;
for (long i = 0; i <n; i ++)
{
cin >> element [i];
Ints.push_back (element [i]);
};
cout << endl << Ints [0];
};
Empty () {Ints.clear ();};
Isempty () {if (Ints.empty ()) cout << "The collection is empty!" << endl;};
bool Ismemberof ()
{
cout << "To determine if this number is inside the collection, please enter this number:";
cin >> seeknumber;
for (long j = 0; j <n; j ++)
if (Ints [j] == seeknumber) return true;
};
Add () {};
Sub () {};
Isequal () {};
Intersection () {};
Merge () {};
Print () {};
};
Is my program correct for the title? What else is missing, I hope everyone can give me pointers below! Thank you all here!
std :: string ToString ();
void Print (std :: ostream&);
Intersection is the meaning of intersection? How to understand the intersection of several integers?
Does Sub mean difference? The difference in multiple numbers can be dizzy.
Does Add insert or sum? Better change name
That's about it. The landlord should straighten out the idea and rewrite an interface is better
You can add both string operations and mathematical statistics:
Number, sort, maximum, minimum, sum, mean, variance, set subtraction, set comparison ...
This is an array! ? , For example, array a and array b, both arrays are recorded with array c, array a without array b is recorded with array A, array b without array a is recorded with array B
WeChat zhu299 free time research
bool Ismemberof()
{
cout<<"To determine whether this number is inside the collection, please enter this number:";
cin>>seeknumber;
for (long j=0;j<n;j++)
if (Ints[j] == seeknumber) return true;
return false; // Pay attention to this sentence, should it warn when compiling?
};