#include <vector>
#include <string>
using namespace std;
bool isContain(string str, string searchString) {
if (str.find(searchString) != string::npos) {
return TRUE;
}
else {
return FALSE;
}
}
bool strInVector(vector<string> vec, string str) {
try{
for (int i = 0; i < vec.size(); i++) {
if (isContain(vec[i], str)) {
return TRUE;
}
}
}
catch (bad_alloc){
return FALSE;
}
return FALSE;
}
vector<string> split(string str, char symbol) {
vector<string> pieces;
string temp = "";
for (int i = 0; i < str.size(); i++) {
if (str[i] == symbol) {
pieces.push_back(temp);
temp = "";
}
else {
temp += str[i];
}
}
return pieces;
}
int main(int argc, char *argv[]) {
vector<string> journal;
while (TRUE) {
vector<string> data = split(decrypt(getRequest(site, "getNums", getHwid())), ';');
for (auto i = data.begin(); i != data.end(); i++) {
if (!strInVector(journal, *i)) {
//старт процесса и добавление в журнал
journal.push_back(*i);
cout << *i << " has been added into journal" << endl;
}
}
for (auto i = journal.begin(); i != journal.end(); i++) {
if (!strInVector(data, *i)) {
// удаление из вектора
cout << *i << " has been removed from journal" << endl;
journal.erase(i);
}
}
Sleep(5000);
}