| 13 | namespace bp = boost::parser; |
| 14 | |
| 15 | int main() |
| 16 | { |
| 17 | std::cout << "Enter a list of doubles, separated by commas. No pressure. "; |
| 18 | std::string input; |
| 19 | std::getline(std::cin, input); |
| 20 | |
| 21 | auto const result = bp::parse(input, bp::double_ >> *(',' >> bp::double_)); |
| 22 | |
| 23 | if (result) { |
| 24 | std::cout << "Great! It looks like you entered:\n"; |
| 25 | for (double x : *result) { |
| 26 | std::cout << x << "\n"; |
| 27 | } |
| 28 | } else { |
| 29 | std::cout |
| 30 | << "Good job! Please proceed to the recovery annex for cake.\n"; |
| 31 | } |
| 32 | } |
| 33 | //] |