CB100

Notas, resueltos y tps de la materia Algoritmos y Estructuras de Datos
Index Commits Files Refs README
commit 19bf67e985f1f5abc13aa2db1d2d9358cc066c45
parent b97c5fce21b4da80f2efe3488e33602d879196aa
Author: mjkloeckner <mjkloeckner@gmail.com>
Date:   Sun, 16 Jun 2024 00:07:31 -0300

add simple linked list example

Diffstat:
Mmain.cpp | 12++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/main.cpp b/main.cpp
@@ -10,8 +10,9 @@
 int main (void) {
     std::ifstream inputFile;
     std::istringstream iss;
-    std::string token;
     std::string line;
+    std::string token;
+    List<std::string> tokens;
 
     const char *file_path = "paradas-de-colectivo.csv";
 
@@ -24,12 +25,19 @@ int main (void) {
     std::getline(inputFile, line); // saltea la primer linea
     while(std::getline(inputFile, line)) {
         iss.str(line);
-            std::cout << ((token == "") ? "" : token.append("\n"));
         while(std::getline(iss, token, INPUT_FILE_DELIM)) {
+            tokens.insert(token);
         }
         iss.clear();
     }
 
     inputFile.close();
+
+    tokens.startCursor();
+    while(tokens.forwardCursor()) {
+        token = tokens.getCursorData();
+        std::cout << ((token == "") ? "" : token.append("\n"));
+    }
+
     return 0;
 }