diff --git a/Project12/Project12.cpp b/Project12/Project12.cpp index affe6f3..639a3ca 100644 --- a/Project12/Project12.cpp +++ b/Project12/Project12.cpp @@ -45,6 +45,10 @@ int main() { vector> 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"; + } + + + } } \ No newline at end of file