|
for (long i = 0; i <n; i ++)
{
cin >> element [i];
Ints.push_back (element [i]);
};
-------------------------------------------------- -
In fact, the array element is superfluous.
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 ++)
Ranch
if (Ints [j] == seeknumber) return true;
Ranch
};
-------------------------------------------------- --------------------
This lookup can be implemented using find (),
Or use vector <int> :: iterator to locate the value of seeknumber!
The ";" after the class is required, but the ";" after the function is not needed, and it is not wrong to add it, but it is not part of the function, but is regarded as a blank line by the compiler.
If you haven't forgotten the corresponding header file, there should be no problem. |
|