diff --git a/main.cpp b/main.cpp index 0712d0b..da6483f 100644 --- a/main.cpp +++ b/main.cpp @@ -5,7 +5,7 @@ #include using string = std::string; -using ilist = std::list; +using slist = std::list; //Place in header! template @@ -24,18 +24,23 @@ int prompti(string,bool*); string prompts(string,bool*); int main() { - printlm("Get the number of 0s before 1 from:"); + printlm("Parse comma deliminated list:"); bool s {}; - ilist lst {}; + slist lst {}; + auto v = prompts("Enter the string: ", &s); + if (!s) { + printlm("Error, No Data!"); + return -1; + } + auto comma = find(v.cbegin(),v.cend(),','); + lst.push_back(string(v.cbegin(),comma)); do { - auto v = prompti("Enter an integer: ", &s); - if (s) { - lst.push_back(v); - } - } while (s); - printm("Number of 0s before 1: "); - const auto the1 = find(lst.cbegin(),lst.cend(),1); - printlm(count(lst.cbegin(),the1, 0)); + auto start = ++comma; + comma = find(start,v.cend(),','); + lst.push_back(string(start, comma)); + } while(comma != v.cend()); + printlm("All entries:"); + for (const auto c : lst) printlm(c); return 0; } diff --git a/main.o b/main.o index 0bea9f4..f7adc89 100644 Binary files a/main.o and b/main.o differ diff --git a/t b/t index e78c877..c784ff6 100755 Binary files a/t and b/t differ