From b7caa92e397dee0c5bad4a30e58de2347434fffc Mon Sep 17 00:00:00 2001 From: Gheiserton Date: Wed, 26 Jul 2023 14:05:32 -0400 Subject: [PATCH] added parts of main to push edge entry information to 2d vector relations --- Project12/Project12.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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