Added routine to capture edge inputs and break into substrings

This commit is contained in:
Fennel Kora 2023-07-26 00:40:51 -04:00
parent c623dbec36
commit d855055e10

View file

@ -31,14 +31,33 @@ Notes
#include <iostream> #include <iostream>
#include "digraph.h" #include "digraph.h"
#include <string>
#include <sstream>
using namespace std;
int main() { int main() {
int nodes; int nodes;
string edgeInput;
cout << "How many nodes will the digraph have?\nEnter number of nodes: "; cout << "How many nodes will the digraph have?\nEnter number of nodes: ";
cin >> nodes; cin >> nodes;
vector<vector<int>> relations; vector<vector<int>> relations;
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"
<< "Enter \'q\' to stop edge entry.\n";
while (edgeInput != "q") {
cout << "\nEdge: ";
cin >> edgeInput;
string a, b;
stringstream ss(edgeInput);
getline(ss, a, '-');
getline(ss, b, '-');
}
} }