I created Class and initialised a vector inside private field, then i initialised vector by useing methods of my Class. Now i need to delete elements in range of two numbers which i have to type on a keyboard
#include <iostream>
#include <vector>
#include <algorithm>
int randomNumber()
{
return (0 + rand() % 50 - 10);
}
class Array {
vector<int>::iterator p;
public:
vector<int>array;
Array(int size)
{
array.resize(size);
generate(array.begin(), array.end(), randomNumber);
}
void Print() {
for (p = array.begin(); p != array.end(); p++) {
cout << *p << ' ';
}
cout << endl;
}
void Condense() {
int a, b;
cout << "Enter your range: [";
cin >> a;
cin >> b;
cout << "]" << endl;
for (p = array.begin(); p != array.end(); p++) {
if (a < *p < b || a > *p < b) {
}
}
}
};