diff --git a/sample/calc.cpp b/sample/calc.cpp index 3f4a0f9..29ad9c3 100644 --- a/sample/calc.cpp +++ b/sample/calc.cpp @@ -155,9 +155,9 @@ struct Grammar : public boost::spirit::classic::grammar { void put(const std::vector& x) { - printf("%f", x[0]); - for (size_t i = 1, n = x.size(); i < n; i++) { - printf(", %f", x[i]); + for (size_t i = 0, n = x.size(); i < n; i++) { + if (i > 0) printf(", "); + printf("%f", x[i]); } }