From dfd0218b2eec273821401b2715f177b7b2de7a22 Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Sun, 6 Nov 2005 22:49:54 +0000 Subject: [PATCH] Bugfix. --- src/parser.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/parser.cpp b/src/parser.cpp index 4bd29f1..b5fccb4 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -115,3 +115,27 @@ output() const } } +/// Hack medio feo para obtener el N del problema +Susanita::size_type +Parser:: +get_n(const std::string& filename) +{ + std::ifstream f(filename.c_str()); + if (!f) + return 0; + std::string l; + if (!std::getline(f, l)) + return 0; + std::istringstream ss(strip(l)); + // descartamos el nombre + get_hasta(ss, ':'); + // contamos personas en la lista + Susanita::size_type count = 0; + while (ss) + { + if (!strip(get_hasta(ss, ',')).empty()) + ++count; + } + return count; +} + -- 2.43.0