added parts of main to push edge entry information to 2d vector relations

This commit is contained in:
Gheiserton 2023-07-26 14:05:32 -04:00
parent d855055e10
commit b7caa92e39

View file

@ -45,6 +45,10 @@ int main() {
vector<vector<int>> relations;
for (int i = 0; i <= nodes; i++) {
relations.push_back({ i });
}
cout << "\nEnter the node connections in the format \"X-Y\" where\n"
<< "X is the source node and Y is the destination node\n";
cout << "Valid nodes range from 0 to " << nodes << " inclusive.\n"
@ -58,6 +62,17 @@ int main() {
stringstream ss(edgeInput);
getline(ss, a, '-');
getline(ss, b, '-');
ss.str({});
try {
relations[stoi(a)].push_back(stoi(b));
}
catch (...) {
cout << "Invalid entry\n";
}
}
}