36 lines
724 B
C++
36 lines
724 B
C++
#include <fstream>
|
|
#include <../inc/my_structures.h>
|
|
#include <../inc/my_operator.h>
|
|
|
|
|
|
bool randomize(float prob) {
|
|
return prob >= (float)(rand() % 1000) / 1000;
|
|
}
|
|
|
|
|
|
int rand_num(int mod) {
|
|
return rand() % (mod) + 1;
|
|
}
|
|
|
|
|
|
vector<string> split(string& s, const char delim[]) {
|
|
vector<string> result;
|
|
size_t pos;
|
|
do {
|
|
if ((pos = s.find(delim)) == string::npos) {
|
|
result.push_back(s);
|
|
break;
|
|
}
|
|
result.push_back(s.substr(0, pos));
|
|
s = s.substr(pos + 1);
|
|
} while (s.length() > 1);
|
|
return result;
|
|
}
|
|
|
|
|
|
Matrix read_file(const char path[]) {
|
|
Matrix result;
|
|
std::ifstream ifile("data/adj_matrix.in");
|
|
ifile >> result;
|
|
return result;
|
|
} |