]> git.llucax.com Git - z.facultad/75.29/susanita.git/commitdiff
Bugfix.
authorLeandro Lucarella <luca@llucax.hn.org>
Sun, 6 Nov 2005 22:49:54 +0000 (22:49 +0000)
committerLeandro Lucarella <luca@llucax.hn.org>
Sun, 6 Nov 2005 22:49:54 +0000 (22:49 +0000)
src/parser.cpp

index 4bd29f13c1fb97d571a485aecac3649356fa28dc..b5fccb43edb77676ac3b5906b9f59e3cbaba34ef 100644 (file)
@@ -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;
+}
+